FOR...TO...DO
...
var xo,xi,ro,y : real;
n,i : integer;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
xo:=1;
repeat
ro:=strtofloat(edit1.Text);
until (ro > 0);
n:=strtoint(spinedit2.text);
for i:=1 to n do
begin
xi:=(xo+(ro/xo))/2;
xo:=xi;
label5.Caption:='Näherungswert x nach dem Heronverfahren: '+ floattostr(xo);
end;
Label7.caption:='Die Zahl '+ floattostr(ro)+ ' hat die Quadratwurzel '+ floattostrF(sqrt(ro),ffFixed,10,4)+' .';
y:=xo*xo;
label8.caption:='=> Probe : '+ floattostr(y);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
spinedit2.Text :='5';
edit1.Text :='';
label5.caption :='';
label7.caption :='';
label8.caption :='';
end;
end.
NEU Komponente SPINEDIT
object SpinEdit2: TSpinEdit Left = 528 Top = 144 Width = 49 Height = 34 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -19 Font.Name = 'MS Sans Serif' Font.Style = [fsBold] MaxLength = 1 MaxValue = 10 MinValue = 5 ParentFont = False TabOrder = 3 Value = 5 end |