Mathe Trainer

  • Möchte das der Trainer die Richtigen und Falschen Antworten raufzählt bleibt aber bei 1 stehen und ich weiss echt nicht warum bitte um Hilfe.

    Spoiler anzeigen


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    $Form2 = GUICreate("Form2", 441, 562, 195, 134)
    $Addieren = GUICtrlCreateCheckbox("Addieren", 96, 24, 97, 17)
    $Subtrahieren = GUICtrlCreateCheckbox("Subtrahieren", 96, 56, 97, 17)
    $Dividieren = GUICtrlCreateCheckbox("Dividieren", 96, 88, 97, 17)
    $Multiplizieren = GUICtrlCreateCheckbox("Multiplizieren", 96, 120, 97, 17)
    $Zahlvon = GUICtrlCreateInput("", 288, 80, 81, 21)
    $Zahlbis = GUICtrlCreateInput("", 288, 136, 81, 21)
    $Zahlvon0bis100 = GUICtrlCreateLabel("Zahl von 0 bis 100", 288, 56, 80, 17)
    $Zahlvon0bis101 = GUICtrlCreateLabel("Zahl von 0 bis 101", 288, 112, 80, 17)
    $Zahlenbereich = GUICtrlCreateLabel("Zahlenbereich", 272, 16, 105, 24)
    GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
    $Auf = GUICtrlCreateInput("", 48, 264, 129, 21)
    $Erg = GUICtrlCreateInput("", 48, 360, 89, 21)
    $Aufgabe = GUICtrlCreateLabel("Aufgabe", 48, 240, 44, 17)
    $Ergebnis = GUICtrlCreateLabel("Ergebnis", 48, 336, 45, 17)
    $Starten = GUICtrlCreateButton("Starten", 72, 192, 163, 25, $WS_GROUP)
    $Pruefen = GUICtrlCreateButton("Prüfen", 72, 480, 163, 25, $WS_GROUP)
    $Rich = GUICtrlCreateInput("", 280, 312, 97, 21)
    $Fal = GUICtrlCreateInput("", 280, 368, 97, 21)
    $Richtige = GUICtrlCreateLabel("Richtige", 280, 288, 43, 17)
    $Falsche = GUICtrlCreateLabel("Falsche", 280, 344, 41, 17)
    GUISetState(@SW_SHOW)


    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    Case $Starten

    if GUICtrlRead ($Addieren) = $GUI_CHECKED then
    $Z1 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $Z2 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " + ",$A)
    $C = GUICtrlSetData($Auf,$Z2,$A)

    EndIf

    if GUICtrlRead ($Subtrahieren) = $GUI_CHECKED then
    $Z1 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $Z2 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " - ",$A)
    $C = GUICtrlSetData($Auf,$Z2,$A)

    EndIf

    if GUICtrlRead ($Dividieren) = $GUI_CHECKED then
    $Z1 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $Z2 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " : ",$A)
    $C = GUICtrlSetData($Auf,$Z2,$A)

    EndIf

    if GUICtrlRead ($Multiplizieren) = $GUI_CHECKED then
    $Z1 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $Z2 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " x ",$A)
    $C = GUICtrlSetData($Auf,$Z2,$A)

    EndIf

    Case $Pruefen

    if GUICtrlRead ($Addieren) = $GUI_CHECKED then
    $SZ = $Z1 + $Z2
    $i = 0

    if GUICtrlRead($Erg) = $SZ Then

    GUICtrlSetData($Rich, $i + 1 )
    $i = $i + 1
    EndIf

    if GUICtrlRead($Erg) <> $SZ Then
    GUICtrlSetData($Fal, "1")
    EndIf
    EndIf

    if GUICtrlRead ($Subtrahieren) = $GUI_CHECKED then
    $SZ = $Z1 - $Z2
    $i = 0

    if GUICtrlRead($Erg) = $SZ Then

    GUICtrlSetData($Rich, $i + 1 )
    $i = $i + 1
    EndIf

    if GUICtrlRead($Erg) <> $SZ Then
    GUICtrlSetData($Fal, "1")
    EndIf
    EndIf

    if GUICtrlRead ($Dividieren) = $GUI_CHECKED then
    $SZ = $Z1 / $Z2
    $i = 0

    if GUICtrlRead($Erg) = $SZ Then

    GUICtrlSetData($Rich, $i + 1 )
    $i = $i + 1
    EndIf

    if GUICtrlRead($Erg) <> $SZ Then
    GUICtrlSetData($Fal, "1")
    EndIf
    EndIf

    if GUICtrlRead ($Multiplizieren) = $GUI_CHECKED then
    $SZ = $Z1 * $Z2
    $i = 0

    if GUICtrlRead($Erg) = $SZ Then

    GUICtrlSetData($Rich, $i + 1 )
    $i = $i + 1
    EndIf

    if GUICtrlRead($Erg) <> $SZ Then
    GUICtrlSetData($Fal, "1")
    EndIf
    EndIf


    EndSwitch
    WEnd

    Der Trainer steht noch am Anfang ich weiss das da noch viele Sachen verbessert werden müssen wie z.B. das man plus und minus gleichzeitig rechnet und so. Aber sitz da grad mal ne Stunde dran und wollte erst einmal das Wesentliche bewältigen.
    MfG

    3 Mal editiert, zuletzt von ScarfacePH (24. Februar 2010 um 15:53)

  • Hi,

    kontrollier mal:
    GUICtrlSetData($Fal, "1")

    Du setzt dort immer auf 1 und hast keine Variable die sich ändert wie bei
    GUICtrlSetData($Rich, $i + 1 )

    ;-))
    Stefan

  • Hi,

    hab mal ein paar Sachen angepasst, u.a. Formatierung.

    Spoiler anzeigen
    [autoit]


    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $Form2 = GUICreate("Form2", 441, 562, 195, 134)
    $Addieren = GUICtrlCreateCheckbox("Addieren", 96, 24, 97, 17)
    $Subtrahieren = GUICtrlCreateCheckbox("Subtrahieren", 96, 56, 97, 17)
    $Dividieren = GUICtrlCreateCheckbox("Dividieren", 96, 88, 97, 17)
    $Multiplizieren = GUICtrlCreateCheckbox("Multiplizieren", 96, 120, 97, 17)
    $Zahlvon = GUICtrlCreateInput("", 288, 80, 81, 21)
    $Zahlbis = GUICtrlCreateInput("", 288, 136, 81, 21)
    $Zahlvon0bis100 = GUICtrlCreateLabel("Zahl von 0 bis 100", 288, 56, 80, 17)
    $Zahlvon0bis101 = GUICtrlCreateLabel("Zahl von 0 bis 101", 288, 112, 80, 17)
    $Zahlenbereich = GUICtrlCreateLabel("Zahlenbereich", 272, 16, 105, 24)
    GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
    $Auf = GUICtrlCreateInput("", 48, 264, 129, 21)
    $Erg = GUICtrlCreateInput("", 48, 360, 89, 21)
    $Aufgabe = GUICtrlCreateLabel("Aufgabe", 48, 240, 44, 17)
    $Ergebnis = GUICtrlCreateLabel("Ergebnis", 48, 336, 45, 17)
    $Starten = GUICtrlCreateButton("Starten", 72, 192, 163, 25, $WS_GROUP)
    $Pruefen = GUICtrlCreateButton("Prüfen", 72, 480, 163, 25, $WS_GROUP)
    $Rich = GUICtrlCreateInput("0", 280, 312, 97, 21)
    $Fal = GUICtrlCreateInput("0", 280, 368, 97, 21)
    $Richtige = GUICtrlCreateLabel("Richtige", 280, 288, 43, 17)
    $Falsche = GUICtrlCreateLabel("Falsche", 280, 344, 41, 17)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $Starten

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($Addieren) = $GUI_CHECKED then
    $Z1 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $Z2 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " + ",$A)
    $C = GUICtrlSetData($Auf,$Z2,$A)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($Subtrahieren) = $GUI_CHECKED then
    $Z1 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $Z2 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " - ",$A)
    $C = GUICtrlSetData($Auf,$Z2,$A)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($Dividieren) = $GUI_CHECKED then
    $Z1 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $Z2 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " : ",$A)
    $C = GUICtrlSetData($Auf,$Z2,$A)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($Multiplizieren) = $GUI_CHECKED then
    $Z1 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $Z2 = Random(GUICtrlRead($Zahlvon),GUICtrlRead($Zahlbis),1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " x ",$A)
    $C = GUICtrlSetData($Auf,$Z2,$A)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $Pruefen

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($Addieren) = $GUI_CHECKED then
    $SZ = $Z1 + $Z2
    if GUICtrlRead($Erg) = $SZ Then GUICtrlSetData($Rich, GUICtrlRead ($Rich) + 1 )
    if GUICtrlRead($Erg) <> $SZ Then GUICtrlSetData($Fal, GUICtrlRead ($Fal) + 1)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($Subtrahieren) = $GUI_CHECKED then
    $SZ = $Z1 - $Z2
    if GUICtrlRead($Erg) = $SZ Then GUICtrlSetData($Rich, GUICtrlRead ($Rich) + 1)
    if GUICtrlRead($Erg) <> $SZ Then GUICtrlSetData($Fal, GUICtrlRead ($Fal) + 1)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($Dividieren) = $GUI_CHECKED then
    $SZ = $Z1 / $Z2
    if GUICtrlRead($Erg) = $SZ Then GUICtrlSetData($Rich, GUICtrlRead ($Rich) + 1 )
    if GUICtrlRead($Erg) <> $SZ Then GUICtrlSetData($Fal, GUICtrlRead ($Fal) + 1)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    if GUICtrlRead ($Multiplizieren) = $GUI_CHECKED then
    $SZ = $Z1 * $Z2
    if GUICtrlRead($Erg) = $SZ Then GUICtrlSetData($Rich, GUICtrlRead ($Rich) + 1 )
    if GUICtrlRead($Erg) <> $SZ Then GUICtrlSetData($Fal, GUICtrlRead ($Fal) + 1)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]

    ;-))
    Stefan

  • Hallo ScarfacePH.

    da du unmittelbar vor der Prüfung den Zähler $i auf 0 setzt fängt gibt dieser immer 1 aus. Auch ist $i ein schlecht gewählter Variablenname, denn wenn du einmal nicht daran denkst und $i z.B. in einer for .... next Schleife verwendest, würdest du die Variable schon wieder überschreiben.
    Ein größeres Problem sehe ich allerdings darin, dass du Checkboxen genommen hast. Du musst wenn mehrere angekreuzt sind auch noch zufällig auswählen, wasfür eine Aufgabe gestellt wird.
    In der 1. Version würde ich an deiner Stelle Radioboxen verwenden, da kann immer nur eine aktiv sein.
    Hier mal das geänderte Skript:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $iRichtig = 0, $iFalsch = 0

    [/autoit] [autoit][/autoit] [autoit]

    $Form2 = GUICreate("Form2", 441, 562, 195, 134)
    $Addieren = GUICtrlCreateRadio("Addieren", 96, 24, 97, 17)
    $Subtrahieren = GUICtrlCreateRadio("Subtrahieren", 96, 56, 97, 17)
    $Dividieren = GUICtrlCreateRadio("Dividieren", 96, 88, 97, 17)
    $Multiplizieren = GUICtrlCreateRadio("Multiplizieren", 96, 120, 97, 17)
    $Zahlvon = GUICtrlCreateInput("", 288, 80, 81, 21)
    $Zahlbis = GUICtrlCreateInput("", 288, 136, 81, 21)
    $Zahlvon0bis100 = GUICtrlCreateLabel("Zahl von 0 bis 100", 288, 56, 80, 17)
    $Zahlvon0bis101 = GUICtrlCreateLabel("Zahl von 0 bis 101", 288, 112, 80, 17)
    $Zahlenbereich = GUICtrlCreateLabel("Zahlenbereich", 272, 16, 105, 24)
    GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
    $Auf = GUICtrlCreateInput("", 48, 264, 129, 21)
    $Erg = GUICtrlCreateInput("", 48, 360, 89, 21)
    $Aufgabe = GUICtrlCreateLabel("Aufgabe", 48, 240, 44, 17)
    $Ergebnis = GUICtrlCreateLabel("Ergebnis", 48, 336, 45, 17)
    $Starten = GUICtrlCreateButton("Starten", 72, 192, 163, 25, $WS_GROUP)
    $Pruefen = GUICtrlCreateButton("Prüfen", 72, 480, 163, 25, $WS_GROUP)
    Global $Rich = GUICtrlCreateInput("", 280, 312, 97, 21)
    Global $Fal = GUICtrlCreateInput("", 280, 368, 97, 21)
    $Richtige = GUICtrlCreateLabel("Richtige", 280, 288, 43, 17)
    $Falsche = GUICtrlCreateLabel("Falsche", 280, 344, 41, 17)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $Starten

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Addieren) = $GUI_CHECKED Then
    $Z1 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $Z2 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " + ", $A)
    $C = GUICtrlSetData($Auf, $Z2, $A)

    [/autoit] [autoit][/autoit] [autoit]

    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Subtrahieren) = $GUI_CHECKED Then
    $Z1 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $Z2 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " - ", $A)
    $C = GUICtrlSetData($Auf, $Z2, $A)

    [/autoit] [autoit][/autoit] [autoit]

    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Dividieren) = $GUI_CHECKED Then
    $Z1 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $Z2 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " : ", $A)
    $C = GUICtrlSetData($Auf, $Z2, $A)

    [/autoit] [autoit][/autoit] [autoit]

    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Multiplizieren) = $GUI_CHECKED Then
    $Z1 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $Z2 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " x ", $A)
    $C = GUICtrlSetData($Auf, $Z2, $A)

    [/autoit] [autoit][/autoit] [autoit]

    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $Pruefen

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Addieren) = $GUI_CHECKED Then
    $SZ = $Z1 + $Z2

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Erg) = $SZ Then
    _richtig()
    Else
    _falsch()
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Subtrahieren) = $GUI_CHECKED Then
    $SZ = $Z1 - $Z2

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Erg) = $SZ Then
    _richtig()
    Else
    _falsch()
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Dividieren) = $GUI_CHECKED Then
    $SZ = $Z1 / $Z2

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Erg) = $SZ Then
    _richtig()
    Else
    _falsch()
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Multiplizieren) = $GUI_CHECKED Then
    $SZ = $Z1 * $Z2

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Erg) = $SZ Then
    _richtig()
    Else
    _falsch()
    EndIf
    EndIf
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _richtig()
    $iRichtig += 1
    GUICtrlSetData($Rich, $iRichtig)
    EndFunc ;==>_richtig

    [/autoit] [autoit][/autoit] [autoit]

    Func _falsch()
    $iFalsch += 1
    GUICtrlSetData($Fal, $iFalsch)
    EndFunc ;==>_falsch

    [/autoit]

    Du solltest auch in der Hilfe den Befehl execute nachlesen, könnte dir bei komplexeren Aufgabenstellungen das errechnen des Ergebnisses erleichtern. Übrigens Jautois hat einen Trainer im Forum Skripte gepostet, dieser ist sehr gut gelungen

    mfg (Auto)Bert

  • Dann stellt sich nun nur noch die Frage wie es funktioniert das man nicht immer wieder das selbe Ergebnis abfragen/prüfen kann. Wäre toll wenn die nächste Aufgabe kommt sobald eine gelöst wurde. Weis da jemand vielleicht einen Ansatz?

  • Geht z.b. so

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $iRichtig = 0, $iFalsch = 0

    [/autoit] [autoit][/autoit] [autoit]

    $Form2 = GUICreate("Form2", 441, 562, 195, 134)
    $Addieren = GUICtrlCreateRadio("Addieren", 96, 24, 97, 17)
    $Subtrahieren = GUICtrlCreateRadio("Subtrahieren", 96, 56, 97, 17)
    $Dividieren = GUICtrlCreateRadio("Dividieren", 96, 88, 97, 17)
    $Multiplizieren = GUICtrlCreateRadio("Multiplizieren", 96, 120, 97, 17)
    $Zahlvon = GUICtrlCreateInput("", 288, 80, 81, 21)
    $Zahlbis = GUICtrlCreateInput("", 288, 136, 81, 21)
    $Zahlvon0bis100 = GUICtrlCreateLabel("Zahl von 0 bis 100", 288, 56, 80, 17)
    $Zahlvon0bis101 = GUICtrlCreateLabel("Zahl von 0 bis 101", 288, 112, 80, 17)
    $Zahlenbereich = GUICtrlCreateLabel("Zahlenbereich", 272, 16, 105, 24)
    GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
    $Auf = GUICtrlCreateInput("", 48, 264, 129, 21)
    $Erg = GUICtrlCreateInput("", 48, 360, 89, 21)
    $Aufgabe = GUICtrlCreateLabel("Aufgabe", 48, 240, 44, 17)
    $Ergebnis = GUICtrlCreateLabel("Ergebnis", 48, 336, 45, 17)
    $Starten = GUICtrlCreateButton("Starten", 72, 192, 163, 25, $WS_GROUP)
    $Pruefen = GUICtrlCreateButton("Prüfen", 72, 480, 163, 25, $WS_GROUP)
    Global $Rich = GUICtrlCreateInput("", 280, 312, 97, 21)
    Global $Fal = GUICtrlCreateInput("", 280, 368, 97, 21)
    $Richtige = GUICtrlCreateLabel("Richtige", 280, 288, 43, 17)
    $Falsche = GUICtrlCreateLabel("Falsche", 280, 344, 41, 17)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $Starten

    [/autoit] [autoit][/autoit] [autoit]

    _start()
    Case $Pruefen

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Addieren) = $GUI_CHECKED Then
    $SZ = $Z1 + $Z2

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Erg) = $SZ Then
    _richtig()
    Else
    _falsch()
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Subtrahieren) = $GUI_CHECKED Then
    $SZ = $Z1 - $Z2

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Erg) = $SZ Then
    _richtig()
    Else
    _falsch()
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Dividieren) = $GUI_CHECKED Then
    $SZ = $Z1 / $Z2

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Erg) = $SZ Then
    _richtig()
    Else
    _falsch()
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Multiplizieren) = $GUI_CHECKED Then
    $SZ = $Z1 * $Z2

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Erg) = $SZ Then
    _richtig()
    Else
    _falsch()
    EndIf
    EndIf
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _richtig()
    $iRichtig += 1
    GUICtrlSetData($Rich, $iRichtig)
    _start()
    EndFunc ;==>_richtig

    [/autoit] [autoit][/autoit] [autoit]

    Func _falsch()
    $iFalsch += 1
    GUICtrlSetData($Fal, $iFalsch)
    EndFunc ;==>_falsch

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _start()
    Global $Z1
    Global $Z2
    If GUICtrlRead($Addieren) = $GUI_CHECKED Then
    $Z1 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $Z2 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " + ", $A)
    $C = GUICtrlSetData($Auf, $Z2, $A)

    [/autoit] [autoit][/autoit] [autoit]

    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Subtrahieren) = $GUI_CHECKED Then
    $Z1 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $Z2 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " - ", $A)
    $C = GUICtrlSetData($Auf, $Z2, $A)

    [/autoit] [autoit][/autoit] [autoit]

    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Dividieren) = $GUI_CHECKED Then
    $Z1 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $Z2 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " : ", $A)
    $C = GUICtrlSetData($Auf, $Z2, $A)

    [/autoit] [autoit][/autoit] [autoit]

    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If GUICtrlRead($Multiplizieren) = $GUI_CHECKED Then
    $Z1 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $Z2 = Random(GUICtrlRead($Zahlvon), GUICtrlRead($Zahlbis), 1)
    $D = GUICtrlSetData($Auf, "")
    $A = GUICtrlSetData($Auf, $Z1)
    $B = GUICtrlSetData($Auf, " x ", $A)
    $C = GUICtrlSetData($Auf, $Z2, $A)

    [/autoit] [autoit][/autoit] [autoit]

    EndIf
    EndFunc ;==>_start

    [/autoit]

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.