Draw Fish Tank using c++ graphic
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>
#include<graphics.h>
void tank();
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\tc\\bgi");
tank();
getch();
closegraph();
}
void tank()
{
for(int i=0;i<240;i++)
{
//tank
setcolor(15);
rectangle(130,160,470,340);
setfillstyle(SOLID_FILL,5);
rectangle(100,130,500,160);
floodfill(101,140,15);
//right stone
setfillstyle(SOLID_FILL,7);
ellipse(452,332,0,360,14,7);
floodfill(452,332,15);
setfillstyle(SOLID_FILL,8);
ellipse(422,332,0,360,14,7);
floodfill(422,332,15);
setfillstyle(SOLID_FILL,8);
ellipse(394,332,0,360,14,7);
floodfill(394,332,15);
setfillstyle(SOLID_FILL,7);
ellipse(372,322,0,360,10,17);
floodfill(372,322,15);
setfillstyle(SOLID_FILL,8);
ellipse(352,324,0,360,10,14);
floodfill(352,324,15);
setfillstyle(SOLID_FILL,7);
ellipse(436,307,0,360,10,17);
floodfill(436,307,15);
setfillstyle(SOLID_FILL,8);
ellipse(458,310,0,360,10,14);
floodfill(458,310,15);
setfillstyle(SOLID_FILL,7);
ellipse(413,317,0,360,14,7);
floodfill(413,317,15);
//left stone
setfillstyle(SOLID_FILL,7);
ellipse(141,322,0,360,10,17);
floodfill(141,322,15);
setfillstyle(SOLID_FILL,8);
ellipse(165,333,0,360,14,7);
floodfill(165,333,15);
setfillstyle(SOLID_FILL,7);
ellipse(159,309,0,360,10,17);
floodfill(159,309,15);
setfillstyle(SOLID_FILL,8);
ellipse(141,290,0,360,10,14);
floodfill(141,290,15);
setfillstyle(SOLID_FILL,7);
ellipse(181,322,0,360,14,7);
floodfill(181,322,15);
// grass
setcolor(GREEN);
ellipse(180,346,50,90,14,8);
ellipse(190,346,50,90,14,8);
ellipse(200,346,50,90,14,8);
ellipse(210,346,50,90,14,8);
ellipse(220,346,50,90,14,8);
ellipse(230,346,50,90,14,8);
ellipse(240,346,50,90,14,8);
ellipse(250,346,50,90,14,8);
ellipse(260,346,50,90,14,8);
ellipse(270,346,50,90,14,8);
ellipse(280,346,50,90,14,8);
ellipse(290,346,50,90,14,8);
ellipse(300,346,50,90,14,8);
ellipse(310,346,50,90,14,8);
ellipse(320,346,50,90,14,8);
ellipse(330,346,50,90,14,8);
ellipse(340,346,50,90,14,8);
ellipse(180,344,50,90,14,8);
ellipse(190,344,50,90,14,8);
ellipse(200,344,50,90,14,8);
ellipse(210,344,50,90,14,8);
ellipse(220,344,50,90,14,8);
ellipse(230,344,50,90,14,8);
ellipse(240,344,50,90,14,8);
ellipse(250,344,50,90,14,8);
ellipse(260,344,50,90,14,8);
ellipse(270,344,50,90,14,8);
ellipse(280,344,50,90,14,8);
ellipse(290,344,50,90,14,8);
ellipse(300,344,50,90,14,8);
ellipse(310,344,50,90,14,8);
ellipse(320,344,50,90,14,8);
ellipse(330,344,50,90,14,8);
ellipse(340,344,50,90,14,8);
setcolor(15);
//fish
setcolor(3);
setfillstyle(SOLID_FILL,3);
ellipse(425-i,232,0,360,24,10);
floodfill(425-i,232,3);
line(450-i,232,465-i,238);
line(450-i,232,465-i,226);
line(465-i,227,465-i,239);
ellipse(435-i,232,190,240,17,17);
ellipse(405-i,235,320,350,28,17);
setcolor(0);
ellipse(402-i,239,50,90,5,8);
outtextxy(408-i,227,".");
setcolor(1);
setfillstyle(SOLID_FILL,1);
ellipse(190+i,190,0,360,24,10);
floodfill(190+i,190,1);
line(150+i,198,165+i,190);
line(150+i,182,165+i,190);
line(150+i,182,150+i,198);
ellipse(202+i,192,190,240,17,17);
ellipse(170+i,195,320,350,28,17);
setcolor(0);
outtextxy(202+i,183,".");
ellipse(210+i,199,50,90,5,8);
setcolor(15);
delay(40);
cleardevice();
}
//tank
setcolor(15);
rectangle(130,160,470,340);
setfillstyle(SOLID_FILL,5);
rectangle(100,130,500,160);
floodfill(101,140,15);
//right stone
setfillstyle(SOLID_FILL,7);
ellipse(452,332,0,360,14,7);
floodfill(452,332,15);
setfillstyle(SOLID_FILL,8);
ellipse(422,332,0,360,14,7);
floodfill(422,332,15);
setfillstyle(SOLID_FILL,8);
ellipse(394,332,0,360,14,7);
floodfill(394,332,15);
setfillstyle(SOLID_FILL,7);
ellipse(372,322,0,360,10,17);
floodfill(372,322,15);
setfillstyle(SOLID_FILL,8);
ellipse(352,324,0,360,10,14);
floodfill(352,324,15);
setfillstyle(SOLID_FILL,7);
ellipse(436,307,0,360,10,17);
floodfill(436,307,15);
setfillstyle(SOLID_FILL,8);
ellipse(458,310,0,360,10,14);
floodfill(458,310,15);
setfillstyle(SOLID_FILL,7);
ellipse(413,317,0,360,14,7);
floodfill(413,317,15);
//left stone
setfillstyle(SOLID_FILL,7);
ellipse(141,322,0,360,10,17);
floodfill(141,322,15);
setfillstyle(SOLID_FILL,8);
ellipse(165,333,0,360,14,7);
floodfill(165,333,15);
setfillstyle(SOLID_FILL,7);
ellipse(159,309,0,360,10,17);
floodfill(159,309,15);
setfillstyle(SOLID_FILL,8);
ellipse(141,290,0,360,10,14);
floodfill(141,290,15);
setfillstyle(SOLID_FILL,7);
ellipse(181,322,0,360,14,7);
floodfill(181,322,15);
// grass
setcolor(GREEN);
ellipse(180,346,50,90,14,8);
ellipse(190,346,50,90,14,8);
ellipse(200,346,50,90,14,8);
ellipse(210,346,50,90,14,8);
ellipse(220,346,50,90,14,8);
ellipse(230,346,50,90,14,8);
ellipse(240,346,50,90,14,8);
ellipse(250,346,50,90,14,8);
ellipse(260,346,50,90,14,8);
ellipse(270,346,50,90,14,8);
ellipse(280,346,50,90,14,8);
ellipse(290,346,50,90,14,8);
ellipse(300,346,50,90,14,8);
ellipse(310,346,50,90,14,8);
ellipse(320,346,50,90,14,8);
ellipse(330,346,50,90,14,8);
ellipse(340,346,50,90,14,8);
ellipse(180,344,50,90,14,8);
ellipse(190,344,50,90,14,8);
ellipse(200,344,50,90,14,8);
ellipse(210,344,50,90,14,8);
ellipse(220,344,50,90,14,8);
ellipse(230,344,50,90,14,8);
ellipse(240,344,50,90,14,8);
ellipse(250,344,50,90,14,8);
ellipse(260,344,50,90,14,8);
ellipse(270,344,50,90,14,8);
ellipse(280,344,50,90,14,8);
ellipse(290,344,50,90,14,8);
ellipse(300,344,50,90,14,8);
ellipse(310,344,50,90,14,8);
ellipse(320,344,50,90,14,8);
ellipse(330,344,50,90,14,8);
ellipse(340,344,50,90,14,8);
setcolor(15);
}
Comments
Post a Comment