C graphics program to countdown

Description:

  1. Use turbo C++ editor to write the program
  2. Give the path of BGI, where the BGI stored in your computer in initgraph function like initgraph(&gd,&gm,”C:\\Turboc3\\BGI”);
  3. Write the logic for countdown

Using functions of graphics.h in Turbo C compiler you can make graphics programs, animations, projects, and games.We can draw circles, lines, rectangles, bars and many other geometrical figures.

				
					#include <graphics.h>
#include <dos.h> 
#include <conio.h> 
int main() 
{
int gd = DETECT, gm, i; 
char a[5]; 
initgraph(&gd, &gm, "C:\\Turboc3\\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