< -->

Program Spiral;
{$D-,E-,G+,N+}
Uses CRT, Graph;
const
  A : Extended = 100;
  B : Extended = 100;
  o1 : Extended = 1.4;
  o2 : Extended = 1;
  dt : Extended = 0.01;
var
  D, R, e : Integer;
  X, Y : Integer;
  Xg, Yg, t : Extended;
begin
  D:= Detect;
  InitGraph(D, R, '');
  e := GraphResult;
  if e<>0 then
  begin
    WriteLn('Ошибка инициализации графического режима, ', e);
    WriteLn(GraphErrorMsg(e));
    Halt;
  end;
  t := 0;
  While not KeyPressed do
  begin
    X := 320 + Round(A * cos(o1*t) );
    Y := 240 - Round(B * sin(o2*t) );
    PutPixel(X, Y, (X+Y+Round(t)) and $0F);
    t := t + dt;
  end;
  t := 0;
  While KeyPressed Do ReadKey;
  ReadKey;
  ClearDevice;
  While not KeyPressed do
  begin
    X := 320 + Round(A * cos(t)*t*0.03);
    Y := 240 - Round(B * sin(t)*t*0.03);
    PutPixel(X, Y, (X+Y+Round(t)) and $0F);
    t := t + dt;
  end;
  While KeyPressed Do ReadKey;
  ReadKey;
  ClearDevice;
  t := 0;
  While not KeyPressed do
   begin
    X := 320 + Round(A * cos(t)*t*0.001);
    Y := 240 - Round(B * sin(t)*t*0.001);
    PutPixel(X, Y, (X+Y+Round(t)) and $0F);
    t := t + dt;
  end;
  CloseGraph;
end.

Назад