HOW TO DRAW A MOVING CAR USING C PROGRAMMING IN COMPUTER GRAPHICS
To draw moving car in c programming copy the code and paste on notepad. Then save in .c extension. then copy the file and paste on the BIN folder which is located in c drive > turbo c folder..
I have explained this program in my YouTube channel..
video link:- https://youtu.be/rmjw2pZDRcU
program:-
#include <stdio.h>
#include <conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm,i=10;
clrscr();
initgraph(&gd, &gm, "c:\\TC\\BGI");
while (i<=600)
{
setcolor(YELLOW);
//body of the car
line(i,200,i+50,200);
line(i,200,i-20,220);
line(i+50,200,i+70,220);
line(i+23,203,i+23,217);
line(i+28,203,i+28,217);
line(i-40,220,i+100,220);
line(i-40,220,i-40,235);
line(i+100,220,i+100,235);
//wheels
circle(i-10,235,7);
circle(i-10,235,2);
circle(i+70,235,7);
circle(i+70,235,2);
//lines beside of wheels
line(i-40,235,i-17,235);
line(i-3,235,i+63,235);
line(i+100,235,i+77,235);
i++;
delay(10);
cleardevice();
}
closegraph();
getch();
}
output:-
Comments
Post a Comment