Autor Beitrag
johi23
Hält's aus hier
Beiträge: 15



BeitragVerfasst: Di 12.11.13 19:50 
Hallo,
Ich möchte bei delphi an ein ergebnis etwas anhängen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
procedure TForm1.Button2Click(Sender: TObject);

var a,b, fall:real;

begin

a:= strtofloat (edit1.Text);
b:= 9.81;

fall:= sqrt ((2*a)/b);

fall:= fall*100;
fall:= round (fall);
fall:= fall/100;

label2.Caption:= floattostr (fall);

end;

end.


Es handelt sich um ein kleines programm welches die Fallgeschwindigkeit berechnet. Ich möchte an das Ergenis ein 's' anhängen. Leider hat das bisher noch nicht funktioniert :/

Moderiert von user profile iconMartok: Delphi-Tags hinzugefügt
Mathematiker
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2622
Erhaltene Danke: 1448

Win 7, 8.1, 10
Delphi 5, 7, 10.1
BeitragVerfasst: Di 12.11.13 20:10 
Hallo,
Strings können addiert werden, d.h. Du kannst
ausblenden Delphi-Quelltext
1:
label2.Caption:= floattostr(fall)+' s';					

schreiben.
Alternativ geht auch die Verwendung des format-Befehls, der Dir zusätzlich die Möglichkeit gibt, die Anzahl der ausgegebenen Ziffern bei floattostr einzustellen.

Beste Grüße
Mathematiker

_________________
Töten im Krieg ist nach meiner Auffassung um nichts besser als gewöhnlicher Mord. Albert Einstein
Tranx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 648
Erhaltene Danke: 85

WIN 2000, WIN XP
D5 Prof
BeitragVerfasst: Di 12.11.13 20:29 
Es geht auch mit

ausblenden Delphi-Quelltext
1:
label2.Caption:= FormatFloat('#,##0.00 s',fall);					

_________________
Toleranz ist eine Grundvoraussetzung für das Leben.