Friday, October 25, 2013

Program to display circles within circle

/* Program to display circles within circle */



#include<graphics.h>
#include<conio.h>
#include<stdio.h>

void main()
{
   int gd = DETECT, gm, x, y, color, angle = 0;
   struct arccoordstype a, b;

   initgraph(&gd, &gm, "..\\bgi");
   delay(2000);

   while(angle<=360)

   {
   setcolor(BLACK);
      arc(getmaxx()/2,getmaxy()/2,angle,angle+2,50);
      setcolor(BLUE);
      getarccoords(&a);
      circle(a.xstart,a.ystart,25);
      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();
   }

No comments:

Post a Comment