Draw Moving a Car - C Language Programming

Program in C Language to Draw Moving a Car



Click here to open this program in Turbo C++

/**********************************************
 Statement - Move a Car
 Programmer - Vineet Choudhary
 Written For - http://developerinsider.co
 **********************************************/
#include <graphics.h>
#include <dos.h>
#include <conio.h> 
 
main()
{
   int i, j = 0, gd = DETECT, gm;
 
   initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");
 
   settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
   outtextxy(25,240,"Press any key to view the moving car");
 
   getch();
   setviewport(0,0,639,440,1);
 
   for( i = 0 ; i <= 420 ; i = i + 10, j++ )
   {
      rectangle(50+i,275,150+i,400);
      rectangle(150+i,350,200+i,400);
      circle(75+i,410,10);
      circle(175+i,410,10);
      setcolor(j);
      delay(100);
 
      if( i == 420 )
         break;
 
      clearviewport();
   }
   getch();
   cleardevice();
   settextstyle(SANS_SERIF_FONT,HORIZ_DIR,2);
   outtextxy(100,200,"Project by http://www.turboc.codeplex.com");
   delay(5000);
   closegraph();
   return 0;
}
You've successfully subscribed to Developer Insider
Great! Next, complete checkout for full access to Developer Insider
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.