C++ Program to draw a moving jeep (Simple Graphics)


Program

#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<math.h>
#include<stdlib.h>
#include<process.h>
void main()
{
clrscr();
int gd=DETECT,gm;
int x=320;
initgraph(&gd,&gm,"C:\\TC\\BGI");
while(!kbhit())
{
setcolor(RED);
line(x,200,x,290);
line(x,290,x+280,290);
line(x+280,290,x+280,100);
line(x+280,100,x+110,100);
line(x+110,100,x+85,200);
line(x+85,200,x,200);
rectangle(x+250,120,x+200,170);
setcolor(3);
circle(x+60,290,30);
circle(x+210,290,30);
delay(50);
cleardevice();
x=x-3;
}
getch();
closegraph();
}

0 comments:

Post a Comment