// This program draws an animated Spirolateral Int v[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} Int dv[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} Int s[]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} Randomize Do Cls; Tabxy (15,13) num=Keyin int ("Enter the order [1-15] of the Spirolateral: ") If num>0 And num<16 Break Loop Do x=0; xmin=0; xmax=0 y=0; ymin=0; ymax=0 Do k=0,4*num-1 If (k%4=0) y=y-v[k%num] If (yxmax) xmax=x If (k%4=2) y=y+v[k%num] If (y>ymax) ymax=y If (k%4=3) x=x-v[k%num] If (x5) dv[k]=5 v[k]=v[k]+s[k]*dv[k] If (v[k]< 10) s[k]= 1 If (v[k]>150) s[k]=-1 Loop k Loop Task spiro (Int long, Int color) // // Draws the "next" line segment of a Spirolateral. // // Calling Parameters: // long: the length of the line segment (in pixels) // color: the color (0-15) of the line segment to be drawn // // [Note: Your program must initially Call Moveto (xstart, ystart) before // first invoking this task. (The parameters xstart,ystart are the co- // ordinates at which you wish to start drawing the Spirolateral.) // Common Int vector=0 Linecolor (color) If vector=0 Call Linerel (0, -long) If vector=1 Call Linerel (long, 0) If vector=2 Call Linerel (0, long) If vector=3 Call Linerel (-long, 0) vector=(vector+1)%4 End spiro