Autor Beitrag
Delphi~Anfänger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 97



BeitragVerfasst: Mi 12.05.04 13:00 
bin noch nen totaler anfänger :oops: also entschuldige ich mich im voraus für dumme fragen

mein code:

l:=strtofloat(edit1.text);
b:=strtofloat(edit2.text);
h:=strtofloat(edit3.text);
v:=l*b*h;
label1:=floattostr(v);


sagt mir bitte den richtigen code thx

Moderiert von user profile iconPeter Lustig (14:15, 12.05.2004): Topic verschoben


Zuletzt bearbeitet von Delphi~Anfänger am Mi 12.05.04 13:17, insgesamt 1-mal bearbeitet
Karlson
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 2088



BeitragVerfasst: Mi 12.05.04 13:02 
hi,

1.) Das ist die falsche Sparte, das müsste ins sonstiges.
2.) Wähle das nächste mal am besten einen anderen titel ;) Brauch dringend Hilfe ist ziemlich nichtssagend ;)

3.) Willst du einfach nur die 3 Variablen multiplizieren?

wenn ja musst du es in integer umwandeln. Mit strtoint.
außerdem muss es label1.caption heissen.


Zuletzt bearbeitet von Karlson am Mi 12.05.04 13:08, insgesamt 1-mal bearbeitet
mk2
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 72

WIN 2000
D4 Prof
BeitragVerfasst: Mi 12.05.04 13:07 
warum integer ?
ich denke was fehlt ist die caption von dem label also statt:

label1:=floattostr(v);

lieber:

ausblenden Delphi-Quelltext
1:
label1.caption:=floattostr(v);					


Ansonsten sollte das gehen, wenn l,b,h und v alles Real oder Extended Variablen sind.

MfG mk2
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Mi 12.05.04 13:08 
4.) Es gibt das wunderbare [ delphi] Tag, bei dem Delphi-Codes schön formatiert werden.

zu 3.) muss nicht in integer umgewandelt werden. wennn er gleitkommazahlen braucht muss er gleitkommazahlen benutzen (was aus dem obigen source bei weitem nicht ersichtlich ist).

ich nehm - genau wie karlson - einfach mal an dass du die drei edit-eingaben multiplizieren willst (um das volumen eines Quaders zu berechnen...) und dass du diese komische fehlermeldung beim drücken auf F9 weghaben willst (irgendwas mit inkompatible typen TLabel und String...):

ganz kurz und richtig gehts so
ausblenden Delphi-Quelltext
1:
Label1.Caption := floattostr( strtofloat(edit1.text) * strtofloat(edit2.text) * strtofloat(edit3.text) );					



raziel

_________________
JSXGraph
mk2
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 72

WIN 2000
D4 Prof
BeitragVerfasst: Mi 12.05.04 13:10 
schneller :D
Delphi~Anfänger Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 97



BeitragVerfasst: Mi 12.05.04 13:13 
thx :lol: :D :D :lol: das war es aber eine frage hätte ich noch wie das nämlich is wenn man die oberfläche eines quaders ausrechnen will ... :arrow: :?:
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 12.05.04 13:15 
Hallo!

Bitte ändere den Titel des Topics da er wenig über das eigentlich Thema verrät. Hier der entsprechende Absatz aus den Delphi-Forum.de Richtlinien:

Richtlinien hat folgendes geschrieben:

1.1 Beiträge
Bitte formuliere den Betreff Deiner Beiträge so, dass andere Mitglieder anhand dieser bereits das eigentliche Thema festmachen können. Beiträge wie etwa "Eine Anfängerfrage" oder "Weiß jemand, wie das geht?" lassen den Leser im Unklaren darüber, was das Thema der Diskussion ist.[...]

Einfach oben bei deinem ersten Beitrag auf "Edit" klicken und den Titel ändern. Dank Dir!


Außerdem gilt: Neue Frage -> Neuer Thread!

Gruß Peter Lustig

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
mk2
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 72

WIN 2000
D4 Prof
BeitragVerfasst: Mi 12.05.04 13:19 
Wenn ich mich nicht irre müßte die Oberfläche folgendes sein:

ausblenden Delphi-Quelltext
1:
o:=2*l*b+2*b*h+2*h*l;					


Zur Erklärung: Die Oberfläche besteht aus 6 Seitenflächen, wovon die Gengenüberliegenden jeweils gleich sind.

MfG mk2
Delphi~Anfänger Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 97



BeitragVerfasst: Mi 12.05.04 13:20 
thx problem cleared :-) :D :D