Circle in Circle



Circle in circle program is used to make designs

How to run this code:

  1. Open your compiler 
  2. Copy the code given below of download the file.
  3. Paste the code on the terminal of your compiler.
  4. Before  debug the code must check the graphics header file is inclue or install in the your compiler , if not install graphics driver in your compiler.
  5. Now run your programe 


#include<graphics.h>

#include<conio.h>

#include<dos.h>

int main()

{

    int gd = DETECT, gm, x, y, color, angle = 0;

    struct arccoordstype a, b;

 

    initgraph(&gd, &gm, "C:\\turboc3\\bgi");

    delay(2000);

 

    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;

}

Post a Comment

Previous Post Next Post