#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 rr,c; float d,x,y,ang,n; printf("give me the fixed point--->"); scanf("%d %d",&p1.x,&p1.y); printf("give me the length -->"); scanf("%d",&rr); printf("give me the step -->"); scanf("%f",&n); printf("give me the angle -->"); scanf("%f",&ang); GraphDriver = DETECT; /* Request auto-detection */ initgraph( &GraphDriver, &GraphMode, "" ); /* just increasing p1 - p2 */ d=0.0; c=1; setcolor(c); x=p1.x; y=p1.y; moveto(x,y); while (rr > 10.0) { linetheta(d,rr,&x,&y); d=fmod(ang+d,360); rr-=n; c=(c++)%16; setcolor(c); } getche(); closegraph(); /* Return the system to text mode */ }