Moving Train using graphics

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<dos.h>
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
// int xmax, ymax;

/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, “”);

/* read result of initialization */
errorcode = graphresult();
/* an error occurred */
if (errorcode != grOk)
{
printf(“Graphics error: %s\n”, grapherrormsg(errorcode));
printf(“Press any key to halt:”);
getch();
exit(1);
}

/* setcolor(getmaxcolor());
xmax = getmaxx();
ymax = getmaxy();

draw a diagonal line */
// int j=0;
for(int i=0;i<1000;i=i+10)
{
line(300+i, 150, 300+i, 100);
line(100+i, 100, 300+i, 100);
line(300+i, 150, 100+i, 150);
line(100+i, 100, 100+i, 150);
for(int j=0;j<300;j=j+30)
{ setcolor(5);
arc(100+i,170,0+j,180+j,20);
arc(300+i,170,0+j,180+j,20);
setcolor(6);
arc(100+i,170,180+j,360+j,20);
arc(300+i,170,180+j,360+j,20);
delay(50);
// cleardevice();
// circle(300+i,170,20);
}
// setcolor
delay(50);
cleardevice();

}
/* for(int i=0;i<1000;i=i+10)
{
line(300+i, 150, 300+i, 100);
line(0+i, 100, 300+i, 100);
line(300+i, 150, 0+i, 150);
line(0+i, 100, 0+i, 150);
circle(0+i,170,20);
circle(300+i,170,20);
delay(100);
cleardevice();
} */

/* clean up */
getch();
closegraph();
return 0;
}

 

 

6 responses to “Moving Train using graphics

  1. Its prefer you understand my attentions! You emerge to reach so plenty around this, prefer you wrote the e-brochure in it or something. I sense that you could do beside a limited p.c. to bang the meaning home a wee pittance, nevertheless different than that, this is impressive blog. A fantastic show. I’ll absolutely be back

  2. Hi, i must say fantastic site you have, i stumbled across it in Google. Does you get much traffic?

  3. Hi, i must say fantastic website you have, i stumbled across it in Bing. Does you get much traffic?

  4. Superb blog you have here but I was curious about if you knew of any forums that cover the same topics talked about here?

    I’d really like to be a part of community where I can get feedback from other experienced people that share the same interest. If you have any suggestions, please let me know. Thanks a lot!

Leave a comment

Calendar

July 2012
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Categories

Archives