#include #include #include #include void main() { int GraphDriver; /* The Graphics device driver */ int GraphMode; /* The Graphics mode value */ struct point { int x,y; } p1; int radius,i,n,c; float d,x,y; printf("give me the center--->"); scanf("%d %d",&p1.x,&p1.y); printf("give me the radius -->"); scanf("%d",&radius); printf("give me the max polygon-->"); scanf("%d",&n); if (n < 3) exit(1); getche(); GraphDriver = DETECT; /* Request auto-detection */ initgraph( &GraphDriver, &GraphMode, "" ); /* just increasing p1 - p2 */ d=2*3.14159/n; setcolor(4); c=4; for (i=0; i<=n; i++) { x=p1.x+radius*cos(d*i); y=p1.y+radius*sin(d*i); if (i == 0) moveto(x,y); else { lineto(x,y); delay(2000); setcolor(c); c=(c++)%16; } } getche(); closegraph(); /* Return the system to text mode */ }