Sorry erstmal, ich wusste nicht, wo ichs sonst hätte reinschreiben sollen.
Naja ich habe mit Lazarus einen mehr oder weniger guten Währungsumrechner zu programmieren und wollte halt am Ende einen Button, mit dem ich alles umrechne, dann hab ichs so versucht, weil irgendwie hat das mit else nicht funktioniert, aber so macht der dann immer mehrer Rechnungen...
Delphi-Quellcode:
procedure TForm1.EurobuttonClick(Sender: TObject);
var rZahl, rOperand, rErgebnis: real;
begin
if
length(Euro.Text)>=1
then
rZahl:= StrToFloat ( Euro.Text);
rOperand:= 1.25;
rErgebnis:= rZahl*rOperand;
Dollar.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat ( Euro.Text);
rOperand:= 0.79;
rErgebnis:= rZahl*rOperand;
Pfund.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat ( Euro.Text);
rOperand:= 40.18;
rErgebnis:= rZahl*rOperand;
Rubel.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat ( Euro.Text);
rOperand:= 99.76;
rErgebnis:= rZahl*rOperand;
Yen.Text:= FloatToStr ( rErgebnis);
if
length(Dollar.Text)>=1
then
rZahl:= StrToFloat ( Dollar.Text) ;
rOperand:= 0.79;
rErgebnis:= rZahl*rOperand ;
Euro.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat ( Dollar.Text) ;
rOperand:= 0.63;
rErgebnis:= rZahl*rOperand ;
Pfund.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat (Dollar.Text) ;
rOperand:= 32.07;
rErgebnis:= rZahl*rOperand ;
Rubel.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat ( Dollar.Text) ;
rOperand:= 79.63;
rErgebnis:= rZahl*rOperand ;
Yen.Text:= FloatToStr ( rErgebnis);
if length(Pfund.Text)>=1
then
rZahl:= StrToFloat ( Pfund.Text) ;
rOperand:= 1.25;
rErgebnis:= rZahl*rOperand ;
Euro.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat ( Pfund.Text) ;
rOperand:= 1.56;
rErgebnis:= rZahl*rOperand ;
Dollar.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat (Pfund.Text) ;
rOperand:= 50.23;
rErgebnis:= rZahl*rOperand ;
Rubel.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat ( Pfund.Text) ;
rOperand:= 124.73;
rErgebnis:= rZahl*rOperand ;
Yen.Text:= FloatToStr ( rErgebnis);
if length(Rubel.Text)>=1
then
rZahl:= StrToFloat ( Rubel.Text) ;
rOperand:= 0.02;
rErgebnis:= rZahl*rOperand ;
Euro.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat ( Rubel.Text) ;
rOperand:= 0.03;
rErgebnis:= rZahl*rOperand ;
Dollar.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat (Rubel.Text) ;
rOperand:= 0.01;
rErgebnis:= rZahl*rOperand ;
Pfund.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat ( Rubel.Text) ;
rOperand:= 2.48;
rErgebnis:= rZahl*rOperand ;
Yen.Text:= FloatToStr ( rErgebnis);
if length(Yen.Text)>=1
then
rZahl:= StrToFloat ( Yen.Text) ;
rOperand:= 0.010;
rErgebnis:= rZahl*rOperand ;
Euro.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat ( Yen.Text) ;
rOperand:= 0.012;
rErgebnis:= rZahl*rOperand ;
Dollar.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat ( Yen.Text) ;
rOperand:= 0.008;
rErgebnis:= rZahl*rOperand ;
Pfund.Text:= FloatToStr ( rErgebnis);
rZahl:= StrToFloat ( Yen.Text) ;
rOperand:= 0.402;
rErgebnis:= rZahl*rOperand ;
Rubel.Text:= FloatToStr ( rErgebnis);
end;
Danke schonmal im vorraus