Description:
- Use turbo C++ editor to write the program
- Give the path of BGI, where the BGI stored in your computer in initgraph function( like initgraph(&gd,&gm,”C:\\Turboc3\\BGI”);)
- 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
#include
#include
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;
}
