hi,
ich habe mir ein kleines Rechen Programm geschrieben, nur funktioniert das in der If anweisung nicht, so habe ich das inzwischen geschrieben:
Eine Behandlungsroutine for OnCreate
Delphi-Quelltext
1: 2: 3: 4:
| randomize; Zahl1 := Random(100) + 1; Zahl2 := Random(100) + 1; Label1.Caption := IntToStr(Zahl1) + ' + ' + IntToStr(Zahl2); |
Eine Behandlungsroutine for OnClick
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10:
| Eingabe := StrToInt(Edit1.Text);
if Zahl1 + Zahl2 then begin Application.MessageBox('Richtig', 'Glückwunsch!', MB_OK); end else begin Application.MessageBox('Falsch', 'Kann passieren!', MB_OK); end; |
wenn ich es jetzt Kompilieren will, dann erhalte ich bei der If Anweisung "if Zahl1 + Zahl2 then" folgende fehlermeldung: "[Error] Unit1.pas(44): Type of expression must be BOOLEAN
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'"
wisst ihr vieleicht was ich da falsch gemacht habe, nur da wo das Plus steht, wird nicht akzepiert. Für jede hilfe bin ich euch sehr danbar.
Andreas