Autor Beitrag
julian2304
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 26



BeitragVerfasst: Di 19.06.07 16:46 
Hallo!

Ich brauche bitte eure Hilfe =)

Ich möchte gerne eine Rechung mit 3 Editfenstern und 1 Label erstellen:

ausblenden Quelltext
1:
2:
  edit1                 edit2                  edit3               label1
 Z A H L 1     R E C H E N Z E I C H E N     Z A H L 2         E R G E B N I S


Aber ich weiß nicht wie ich das hinbekommen soll. :(:(:(

Hier schonmal ein Anfang. Ich weiß überhaupt nicht ob das überhaupt stimmt! :oops: :cry: :cry:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
var
  Form1: TForm1;
  zahl1,zahl2: real;
  rechenzeichen: string;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
Zahl1:=strtofloat(edit_eingabe.text);
Zahl2:=strtofloat(edit_ausgabe.text);

if rechenzeichen = '+' then edit_rechenzeichen.text:=floattostr(zahl1+zahl2);
if rechenzeichen = '-' then edit_rechenzeichen.text:=floattostr(zahl1-zahl2);
if rechenzeichen = '*' then edit_rechenzeichen.text:=floattostr(zahl1+zahl2);
if rechenzeichen = '/' then edit_rechenzeichen.text:=floattostr(zahl1/zahl2);
end;

end.



Moderiert von user profile iconKlabautermann: Topic aus Sonstiges (Delphi) verschoben am Di 19.06.2007 um 18:00
bflegel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 193
Erhaltene Danke: 1

Win XP, Win 7, BS2000
D5
BeitragVerfasst: Di 19.06.07 17:14 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Button1Click(Sender: TObject);
var
  zahl1,zahl2: real;        // variable muss nicht global definiert werden!
begin
Zahl1:=strtofloat(edit1.text);
Zahl2:=strtofloat(edit3.text);

if edit2.text = '+' then label1.caption := floattostr(zahl1+zahl2);
if edit2.text = '-' then label1.caption := floattostr(zahl1-zahl2);
if edit2.text = '*' then label1.caption := floattostr(zahl1*zahl2);
if edit2.text = '/' then label1.caption := floattostr(zahl1/zahl2);
end;


bye
bflegel

//edit: Ups, Variable rechenzeichen gelöscht, wird nicht gebraucht!

_________________
I know all the jokes about my name
julian2304 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 26



BeitragVerfasst: Di 19.06.07 17:30 
VIELEN VIELEN DANK!!! DAS HAT MIR WIRKLICH SHER GEHOLFEN!!! :zustimm: :zustimm: :zustimm: