Program Tree;
Uses Graph, CRT;
var
D, R, e : Integer;
i, j : Word;
Ar : array[1..512] of Real;
Ar1 : array[1..512] of Real;
delta : Real;
NumPoint : Word;
begin
D := Detect;
InitGraph(D, R, '');
e := GraphResult;
if e <> grOk then
begin
WriteLn('Ошибка инициализации графического режима!(ошибка ', e,')');
WriteLn(GraphErrorMsg(e));
Halt($FA00+e);
end;
NumPoint := 1;
Ar[1]:=320;
for i := 0 to 9 do
begin
NumPoint := Round(exp(1.0*i*Ln(2)));
delta := 640.0/(NumPoint*1.0+1.0);
for j := 1 to 512 do Ar1[j] := Ar[j];
Ar[1] := delta;
for j := 2 to NumPoint do
Ar[j] := Ar[j-1] + delta;
for j := 1 to NumPoint div 2 do
begin
if (2*j-1) mod 15 <> 0 then
SetColor((2*j-1) mod 15) else
SetColor(Green);
Line(Round(Ar1[j]-1),529-50*i,Round(Ar[2*j-1]-1),529-50*(i+1));
if (2*j) mod 15 <> 0 then
SetColor((2*j) mod 15) else
SetColor(Red);
Line(Round(Ar1[j]-1),529-50*i,Round(Ar[2*j]-1),529-50*(i+1));
end;
end;
ReadKey;
CloseGraph;
end.