// http://www.programmingsimplified.com/c/program/moving-car
// bgi movingCar.cpp

#include <graphics.h>
#include <dos.h>
#include <conio.h> 
 
main()
{
   int i, j=0;
 
   initwindow(800,600,"Moving Car");
 
   settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
   outtextxy(25,240,"Press any key to view the moving car");
 
   getch();
   setviewport(0,0,800,600,1);
 
   for (i=0 ; i<=550 ; 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%8+8);
      delay(70);
 
      if( i == 550 )
         break;
 
      clearviewport();
   }
 
   outtextxy(100,240,"Press any key to continue ...");
   getch();
   closegraph();
   return 0;
}
