ich habe folgenden quelltext, allerdings gibt er etliche fehlermeldungen aus, z.B. zeile 21 und 22 erwartet er ein statement findet aber label
in zeile 22, will er ein simikolon oder ein komma statt ein punkt, aber das geht doch gar nicht oder?
in zeile 22, will er ein simikolon oder ein komma statt der klammer vor zahl1
ausserdem dividiert er immer, auch wenn er bei "label_aufgabeausgeben" eine additons-,subtraktions- oder multiplikationsaufgabe ausgibt.
wär nett wenn ihr mir helfen könntet
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54:
| procedure TForm8.Button_AufgabeStellenClick(Sender: TObject); begin randomize; REPEAT Zahl1:= random (100)+1; Zahl2:= random (100)+1; n:= random (4); if n=0 then begin rechenzeichen:='+'; result:= Zahl1+Zahl2; end; if n=1 then begin rechenzeichen:='-'; result:= Zahl1-Zahl2; end; if n=2 then begin rechenzeichen:='*'; result:= Zahl1*Zahl2; end; if n=3 then begin rechenzeichen:='/'; result:= Zahl1/Zahl2; end;
Until ((Zahl1 MOD Zahl2 =0) AND (Zahl1 >Zahl2)); Label _AufgabeAusgeben.Caption:=IntToStr(Zahl1)+' '+rechenzeichen+ ' '+IntToStr (Zahl2) ; end;
procedure TForm8.Button_ErgebnisPruefenClick(Sender: TObject); begin ergebnis:=StrToInt(Edit_ErgebnisEingeben.text); if (ergebnis=result) then Label_AusgabeRichtigFalsch.caption:='richtig' else Label_AusgabeRichtigFalsch.caption:= 'falsch'; begin if Label_AusgabeRichtigFalsch.caption = 'falsch' then; begin if n=0 then Label_AusgabeRichtigesErgebnis.caption:=IntToStr(Zahl1+Zahl2) ; end; begin if n=1 then; Label_AusgabeRichtigesErgebnis.caption:=IntToStr(Zahl1-Zahl2) ; end; begin if n=2 then; Label_AusgabeRichtigesErgebnis.caption:=IntToStr(Zahl1*Zahl2) ; end; begin if n=3 then; Label_AusgabeRichtigesErgebnis.caption:=FloatToStr(Zahl1/Zahl2) ; if Label_AusgabeRichtigFalsch.caption = 'richtig' then Label_AusgabeRichtigesErgebnis. caption:='-'; end; end; end; |