#include #include #include #include void main() { int GraphDriver; /* The Graphics device driver */ int GraphMode; /* The Graphics mode value */ struct point { int x,y; } p1,pp[40]; int radius,i,n; float d; 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(6); for (i=0; i<=n; i++) { pp[i].x=p1.x+radius*cos(d*i); pp[i].y=p1.y+radius*sin(d*i); } drawpoly(n+1,(int *)pp); getche(); closegraph(); /* Return the system to text mode */ }