C graphics program to draw circles in circles

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 circle of circle

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

				
					#include<graphics.h> 
#include<conio.h> 
#include<dos.h> 
main() 
{
int gd = DETECT, gm, x, y, color, angle = 0; 
struct arccoordstype a, b; 
initgraph(&gd, &gm, "C:\\Turboc3\\BGI"); 
delay(2500); 
while(angle<=360) 
{
setcolor(BLACK); 
arc(getmaxx()/2,getmaxy()/2,angle,angle+2,100); 
setcolor(RED); 
getarccoords(&a); 
circle(a.xstart,a.ystart,25); 
setcolor(BLACK); 
arc(getmaxx()/2,getmaxy()/2,angle,angle+2,150); 
getarccoords(&a); 
setcolor(GREEN); 
circle(a.xstart,a.ystart,25); 
angle = angle+5; 
delay(50); 
} 
getch();
closegraph(); 
return 0; 
}
				
			

Leave a Reply