解答:8−2−1

奇数番目の点と偶数番目の点とで交互に半径の値を入れ替えるプログラム

procedure TForm1.Button1Click(Sender: TObject);

var pai, th, incr, r, x, y: real;
   i, n_div, xc, yc: integer;

begin

   pai := 3.1415;
   r := 100;
   n_div := 100;
   incr := 2 * pai / n_div;
   xc := 200; yc := 200;

   th := 0;
   for i:= 1 to n_div+1 do begin

   if i mod 2 = 0 then begin

      x := r * cos(th);
      y := r * sin(th);

   end else begin

      x := 1.2*r * cos(th);
      y := 1.2*r * sin(th);

   end;

   if i = 1 then Canvas.MoveTo( xc+round(x), yc - round(y) )
        else Canvas.LineTo( xc+round(x), yc - round(y) );

        th := th + incr;

   end;

end;

end.