9) This c graphics program performs countdown for 30 seconds.


#include<graphics.h>
#include<dos.h>
#include<conio.h>
main()
{
int gd = DETECT, gm, i;
char a[5];
initgraph( &gd, &gm, “C:\\TC\\BGI”);
settextjustify( CENTER_TEXT, CENTER_TEXT );
settextstyle(DEFAULT_FONT,HORIZ_DIR,3);
setcolor(RED);
for(i = 30 ; i >=0 ; i–)
{
sprintf(a,”%d”,i);
outtextxy(getmaxx()/2, getmaxy()/2, a);
delay(1000);
if ( i == 0 )
break;
cleardevice();
}
getch();
closegraph();
return 0;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s