#include #include #include #include void linetheta(float ang, int l, float *x, float *y) { float rad=3.14159/180,k1,k2; k1=l*cos(rad*ang); k2=l*sin(rad*ang); *x+=k1; *y+=k2; lineto(*x,*y); } 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,j,c; float d,x,y,ang; printf("give me the fixed point--->"); scanf("%d %d",&p1.x,&p1.y); printf("give me the length -->"); scanf("%d",&radius); printf("give me the max polygon-->"); scanf("%d",&n); if (n < 3) exit(1); getche(); GraphDriver = DETECT; c=1; /* Request auto-detection */ initgraph( &GraphDriver, &GraphMode, "" ); /* just increasing p1 - p2 */ for (i=3; i<=n; i++) { ang=0.0; setcolor(c); x=p1.x; y=p1.y; moveto(x,y); d=360.0/i; for (j=0; j