Tuesday, 23 December 2014

Animated moving car program : computer graphics in C


Today Friends I Want To Tell You How We Write a Simple Animated

Moving Car Program Using Computer Graphics in C...

Here is the source code for Animated Moving Car using graphics.h

header file...


Complied On :- Turbo C

Graphics Header File :- graphics.h

Used Pre-Defined Graphics Function :-



1. initgraph() :- Initializes the graphics system .

2. settextstyle() :- Style and Font of the Text .

3. rectangle() :- Draws a rectangle in graphics mode.

4.circle() :- Draws a circle in graphics mode.

5.setcolor() :- Set the specified Color in graphics mode.

6.delay() :- Delay of the Specified time.

7.closegraph() :- Shuts down the graphics system.

Save :- .c file (C Program)



#include<stdio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
int i ,j=0;
initgraph(&gd,&gm,"C:\\TC\\BGI");
settextstyle(GOTHIC_FONT,HORIZ_DIR,4);
getch();
i=0;
while(i<=420)
{
rectangle(150+i,350,200+i,400);
rectangle(50+i,275,150+i,400);
circle(175+i,410,10);
circle(75+i,410,10);
setcolor(j++);
delay(100);
i=i+10;
cleardevice();
}
getch();
closegraph();
}


Thank You Keep visiting

No comments:

Post a Comment