codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> #include<stdlib.h> #include<dos.h> void Action(); class CShape { public: virtual void Draw()=0; } ; class CPointer:public CShape { public: int x; int y; int color; public: CPointer(int z1,int z2,int color) { x=z1; y=z2; color=color; } ; void Draw() { putpixel(x,y,color); } ; } ; class CLine:public CPointer { int x1; int y1; public: CLine(int z1,int z2,int z3,int z4, int col):CPointer(z1,z2,col) { x1=z3; y1=z4; setcolor(col); } ; void Draw() { line (x,y,x1,y1); } ; } ; class CCircle:public CPointer { public: int r; public: CCircle(int z1,int z2,int z5):CPointer(z1,z2,color) { r=z5; } ; void Draw() { circle (x,y,r); } ; } ; class CRec:public CLine { int x1; int y1; public: CRec(int z1,int z2,int z3,int z4):CLine(z1,z2,z3,z4,color) { x1=z3; y1=z4; } ; void Draw() { rectangle (x,y,x1,y1); } ; } ; class CArc:public CCircle { public: int stangle; int endangle; public: CArc(int z1,int z2,int z6,int z7,int z5):CCircle(z1,z2,z5) { stangle=z6; endangle=z7; } ; void Draw() { arc (x,y,stangle,endangle,r); } ; } ; class CElips:public CArc { public: int xradius; int yradius; public: CElips(int z1,int z2,int z6, int z7,int z5,int z9):CArc(z1,z2,z6,z7,z5) { xradius= z5; yradius=z9; } ; void Draw() { ellipse(x,y,stangle,endangle,xradius,yradius); } ; } ; class CColor:public CPointer { public: int selectcolor; public: CColor(int z1,int z2,int col,int selectz):CPointer(z1,z2,col) { x=z1; y=z2; color=col=15; selectcolor=selectz; } ; void Draw() { setfillstyle(1,selectcolor); floodfill(x,y,color); } ; } ; int main() { int gdriver=DETECT, gmode, errorcode; initgraph(&gdriver,&gmode,""); errorcode=graphresult(); if (errorcode!=grOk) { printf("Error"); printf("Press key"); getch(); exit(1); } CShape *picture[118]; CShape *colorpicture[45]; picture[0] = new CLine (0, 150, 640, 150, 15); //horizont picture[1] = new CLine (350, 216, 459,216, 15);//tank 1 picture[2] = new CLine (459, 216, 459,232, 15); picture[3] = new CLine (350, 216, 313,232, 15); picture[4] = new CLine (313, 232, 459, 232, 15); picture[5] = new CCircle (333, 240, 8); picture[6] = new CCircle (439, 240, 8); picture[7] = new CLine (333, 248, 439, 248, 15); picture[8] = new CRec (299, 196, 396, 203); picture[9] = new CLine (0, 150, 1, 150, 9); picture[10] = new CElips (426, 201, 56, 56, 30, 15); //tank 2 picture[11] = new CRec (420, 285, 517, 291); picture[12] = new CLine (0, 150, 1, 150, 9); picture[13] = new CLine (471, 304, 580, 304, 15); picture[14] = new CLine (580, 305, 580, 321, 15); picture[15] = new CLine (434, 321 , 580, 321, 15); picture[16] = new CLine (434, 321, 471, 305, 15); picture[17] = new CCircle (454, 329, 8); picture[18] = new CCircle (560, 329, 8); picture[19] = new CLine (454, 337, 560, 337, 9); //tank 3 picture[20] = new CElips (546, 287, 56, 56, 30, 17); picture[21] = new CLine (261, 384, 370, 384, 9); picture[22] = new CLine (370, 384, 370, 403, 9); picture[23] = new CLine (224, 403, 370, 403, 9); picture[24] = new CLine (224, 403, 261, 384, 9); picture[25] = new CCircle (244, 411, 8); picture[26] = new CCircle (350, 411, 8); picture[27] = new CLine (244, 419, 350, 419, 9); picture[28] = new CRec (210, 363, 307, 370); picture[29] = new CLine (0, 150, 1, 150, 15); picture[30] = new CElips (337, 367, 56, 56, 30, 17); picture[31] = new CLine (546, 240 , 546, 271, 15); picture[32] = new CRec (546, 240, 600, 260); picture[33] = new CLine (546, 250, 600, 250, 15); picture[34] = new CLine (200, 150, 240, 100, 15); picture[35] = new CLine (240, 100, 280, 90, 15); picture[36] = new CLine (280, 90, 320, 10, 15); picture[37] = new CLine (320, 10, 420, 120, 15); picture[38] = new CLine (420, 120, 460, 100, 15); picture[39] = new CLine (460, 100, 600, 150, 15); colorpicture[0]=new CColor(504,93,15,9); colorpicture[1]=new CColor(200,200,15,2); colorpicture[2]=new CColor(301,200,15,0); colorpicture[3]=new CColor(361,225,15,7);//korpusa colorpicture[4]=new CColor(475,315,15,7); colorpicture[5]=new CColor(306,396,15,7); colorpicture[6]=new CColor(307,198,15,7);//stvoli colorpicture[7]=new CColor(444,289,15,7); colorpicture[8]=new CColor(212,365,15,7); colorpicture[9]=new CColor(436,195,15,8);//viskli colorpicture[10]=new CColor(560,287,15,8); colorpicture[11]=new CColor(339,369,15,8); colorpicture[12]=new CColor(335,242,15,0);//kolesa 1 tank colorpicture[13]=new CColor(441,242,15,0); colorpicture[14]=new CColor(446,331,15,0);//kolesa 2 tank colorpicture[15]=new CColor(562,331,15,0); colorpicture[16]=new CColor(246,413,15,0);//kolesa 3 tank colorpicture[17]=new CColor(352,413,15,0); colorpicture[18]=new CColor(373,242,15,6);//gusin` colorpicture[19]=new CColor(507,332,15,6); colorpicture[20]=new CColor(300,411,15,6); colorpicture[21]=new CColor(547,242,15,14);//FLAG OF UKRAINE colorpicture[22]=new CColor(547,252,15,1); for (int i=0;i<40;++i) picture [i]->Draw(); for(int j=0;j<23;j++) { colorpicture[j]->Draw(); } Action(); getch(); closegraph(); return 0; } void Action() { //ruh 1 tanka int maxy; int symove; char *p; int size; maxy=480; int x1,y1; int x2,y2; int sx,sy; x1=296; y1=178; x2=463; y2=253; sx=x1; sy=y1; symove=1; size=imagesize(x1,x1,x2,y2); p=new char(size); getimage(x1,y1,x2,y2,p); do { putimage(sx,sy,p,0); delay(10); putimage(sx,sy,p,0); sx--; } while(sx>0); free(p); //ruh 2 tanka int size1; int h=130; int sxmove1,symove1; char *p1; int x11,y11; int x21,y21; int sx1,sy1; x11=414; y11=240; x21=600; y21=344; sx1=x11; sy1=y11; sxmove1=1; symove1=0; size1=imagesize(x11,x11,x21,y21); p1=new char(size1); getimage(x11,y11,x21,y21,p1); do { putimage(sx1,sy1,p1,COPY_PUT); delay(15); putimage(sx1,sy1,p1,COPY_PUT); sx1--; } while(sx1>0); free(p1); //ruh 3 tanka int size2; int h2=70; int sxmove2,symove2; char *p2; int x12,y12; int x22,y22; int sx2,sy2; x12=200; y12=320; x22=400; y22=431; sx2=x12; sy2=y12; sxmove2=1; symove2=0; size2=imagesize(x12,y12,x22,y22); p2=new char(size2); getimage(x12,y12,x22,y22,p2); do { putimage(sx2,sy2,p2,COPY_PUT); delay(20); putimage(sx2,sy2,p2,COPY_PUT); sx2--; } while(sx2>0); free(p1); settextstyle(0,0,2); outtextxy(290,300,"Finish"); outtextxy(290,330,"Developer Roma Bodian"); getch(); }
Private
[
?
]
Run code
Submit