Programming Blog

This blog is about technical and programming questions and there solutions. I also cover programs that were asked in various interviews, it will help you to crack the coding round of various interviews

Wednesday 19 September 2018

C program to create a moving car


#include <graphics.h>
#include <dos.h>
#include <conio.h> 
main()
{
   int i, j = 0, gd = DETECT, gm;

   initgraph(&gd,&gm,"C:\\TC\\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();
   closegraph();
   return 0;
}

1 comment:

  1. Harrah's Casino Resort And Spa - Temecula, AZ - KTNV
    Located in Temecula, 공주 출장샵 Harrah's Casino Resort 김포 출장샵 and Spa is 세종특별자치 출장마사지 an easy 구미 출장샵 getaway. The 문경 출장샵 casino features a full-service spa, a sports bar, a restaurant and

    ReplyDelete