C program to for Moving Car

Friday, October 2nd, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<dos.h>
#include<graphics.h>
 
void main()
{
	int gd=DETECT,gm;
	int i=0,m=0;
	initgraph(&gd,&gm,"..\\bgi");
	while(!kbhit())
	{
		cleardevice();
		i++;
		if(i>getmaxx())
			i-=670;
		line(80+i,300,90+i,270);
		line(90+i,270,120+i,270);
		line(120+i,270,160+i,240);
		line(160+i,240,230+i,240);
		line(230+i,240,275+i,270);
		line(275+i,270,310+i,270);
		line(310+i,270,335+i,290);
		line(335+i,290,335+i,300);
		line(255+i,300,335+i,300);
		line(180+i,300,210+i,300);
		line(80+i,300,135+i,300);
		arc(232+i,300,0,180,23);
		arc(157+i,300,0,180,23);
		circle(232+i,300,18);
		circle(157+i,300,18);
		pieslice(232+i,300,0+m,90+m,18);
		pieslice(232+i,300,180+m,270+m,18);
		pieslice(157+i,300,0+m,90+m,18);
		pieslice(157+i,300,180+m,270+m,18);
		if(m<-360)
			m=90;
		m-=3;	
	delay(5);
	}
	getch();
	closegraph();
}
Avatar Image

Author Name :
Ranjith

Total : 8 Comments


8 Responses to “C program to for Moving Car”

  1. robin singh says:

    which header files you use in this program.

  2. aniruddh bhatt says:

    there is error in your program.

    not initialize graphics.

  3. Ahmed says:

    I cant run in my Compiler (turbo c++ 3.0). Why?

  4. sanket says:

    There is one error in program.I can solve this error.
    you have write
    initgraph(&gd,&gm,”c:\\tc\\bgi”);
    and run the program….

  5. Anirudh rachit says:

    initgraph(&gd,&gm,”c:\\tc\\bgi”); except this mistake it was awesome man

  6. Hats off to u says:

    what a gr8 programming
    Hats off!!!!

  7. rhy says:

    nice one…cool!

  8. Fail says:

    I have 1 error on this
    int gd=DETECT,gm;

Leave a Reply

Question and Answer
C/C++ Unix & Linux Wordpress
Source codes
C C++ Java

Free email signup