Pseudo Code:
var
x0,x1,e,p,q:real;
i,n:integer;
begin
x0:=strtofloat(edit1.Text);
e:=0.0001;
i:=0;
n:=strtoint(edit2.Text);
repeat
i:=i+1;
listbox1.Items.add(inttostr(i));
listbox2.Items.add(floattostr(x0));
x1:=sqrt(cos(x0));
listbox3.Items.add(floattostr(x1));
p:=(x1-x0)/x1;
q:=abs(p);
listbox4.Items.add(floattostr(q));
x0:=x1;
until
q<e;
edit3.Text:=floattostr(x1);
end;
end.
0 comments: