TEAM CODING-BCA

C Program for Displaying a Moving Car

C Program for Displaying a Moving Car :

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>

void main()
{
int i;
int gd,gm;
detectgraph(&gd,&gm);

initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
setcolor(11);

for(i=0;i<400;i=i+10)
{
cleardevice();
rectangle(10+i,100,120+i,250);
setfillstyle(SOLID_FILL,9);
floodfill(11+i,101,11);
rectangle(120+i,200,150+i,250);
setfillstyle(SOLID_FILL,9);
floodfill(121+i,201,11);
circle(30+i,270,18);
I
setfillstyle(SOLID_FILL,BROWN);
floodfill(31+i,271,11);
circle(100+i,270,18);
setfillstyle(SOLID_FILL,BROWN);
floodfill(101+i,271,11);
delay(70);
}

getch();
closegraph();
}

Output


No comments:

Post a Comment