Sunrise in C

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gdriver = DETECT, gmode, errorcode;
int midx,midy,radius=10;
initgraph(&gdriver, &gmode, "c:/tc/bgi");
errorcode = graphresult();
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
midx=getmaxx()/2;
while(radius<=40)
{
cleardevice();
line(0,210,160,50);
setcolor(WHITE);
line(160,50,320,210);
line(320,210,480,50);
line(480,50,640,210);
line(0,210,640,210);

arc(midx,210,45,133,radius);
setfillstyle(SOLID_FILL, YELLOW);
floodfill(midx,200,15);
setcolor(BLUE);
setfillstyle(SOLID_FILL, LIGHTBLUE);
floodfill(2,2,15);
setfillstyle(SOLID_FILL, BROWN);
floodfill(150,150,15);
floodfill(550,150,15);
setcolor(15);
line(0,400,640,300);
setfillstyle(SOLID_FILL, BLUE);
floodfill(2,350,15);
setfillstyle(SOLID_FILL, GREEN);
floodfill(2,410,15);
delay(100);
radius+=1;
}
getch();
}

Post a Comment

0 Comments