Thursday, November 18, 2010

Sunset in C

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gdriver = DETECT, gmode, errorcode;
int midx,midy,radius=40;
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>=10)
{
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,135,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;
}
if(radius<=10)
cleardevice();
getch();
}

0 comments:

Post a Comment

Contact Form

Name

Email *

Message *