- Код: Выделить всё
Uses
Graph, Crt;
Const
f_root = 30;
step = 0.05;
Var
tmp,x: Real;
first_step: boolean;
value: Integer;
driver,mode: Integer;
Function Root(indx,expon: Extended): Extended;
Begin
If (expon = 0) Or (indx = 0) Then Root:=0
Else
If (round(indx) mod 2 =0) Then
If (expon < 0) Then Root:=0
Else Root:= exp(Ln(expon)/indx)
Else
If (round(indx) mod 2 =1) Then
If (expon < 0) Then Root:= -exp(Ln(-expon)/indx)
Else Root:= exp(Ln(expon)/indx)
Else Root:= exp(Ln(expon)/indx);
End;
Begin
DetectGraph(Driver, Mode);
Mode := m800x600;
InitGraph(Driver, Mode, '');
first_step:= true;
tmp:= 10;
x:= -tmp;
While (x <= tmp) do
begin
If (Round(x / step) = 0) then first_step:= true
else
begin
Value:= Trunc(root(2,x) * f_root);
If first_step then
begin
first_step:= false;
MoveTo((300 + Trunc(x * f_root)), (300 - Value));
end
else LineTo((300 + Trunc(x * f_root)), (300 - Value));
end;
x:= x + step;
delay(10);
end;
Readkey;
CloseGraph;
End.
помогите с найти ошибку! Ошибка в том тош-то он рисует впереди квадратного корня простую линию .
!!!!!!!!! Tmp dolzno ostatsa 10