Einzelnen Beitrag anzeigen

SilasF.

Registriert seit: 17. Sep 2012
3 Beiträge
 
#1

Anweisung erfolderlich, aber Ausdruck vom Typ Boolean?

  Alt 17. Sep 2012, 14:27
Hallo zusammen.
Unsere Aufgabe ist es ein Programm zu machen welches 3 Zufallszahlen ausspucken soll und
dann sagen soll welches das größte ist..
soweit bin ich bis jetzt:
Delphi-Quellcode:
var
  Form1: TForm1;
  Zahl1 , Zahl2 , Zahl3 : Integer ;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
Zahl1:= Random(100) ;
Zahl2:= Random(100) ;
Zahl3:= Random(100) ;
label1.Caption:= inttostr (Zahl1) ;
Label2.Caption:= inttostr (Zahl2) ;
Label3.Caption:= inttostr (Zahl3) ;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if StrToInt (label1.caption) > Zahl2
then label4.caption :='Zahl1 ist die größte Zahl!'
else if StrToInt (label1.Caption) < Zahl2
then label4.caption :='Zahl2 ist die größte Zahl!' ;
if StrToInt (label1.Caption) > Zahl3
then label4.Caption :='Zahl1 ist die größte Zahl!'
else if StrToInt (label1.caption) < Zahl3
then label4.caption :='Zahl 3 ist die größte Zahl!'  ;
if StrToInt (label2.caption) > Zahl3
then label4.caption :='Zahl2 ist die größte Zahl!'
else StrToInt (label2.caption) < Zahl3
then label4.caption :='Zahl3 ist die größte Zahl' ;

end;

end.
jedoch zeigt er in der Letzten Zeile an(also bei then): Anweisung erfolderlich,
aber Ausdruck vom Typ Boolean gefunden?
Was muss ich nun tun?
Danke im Vorraus

Geändert von TBx (17. Sep 2012 um 18:34 Uhr) Grund: Delphi-Tags eingefügt, bitte zukünftig selber machen
  Mit Zitat antworten Zitat