Hi zusammen,
ich schreibe gerade für Samstag für die Schule (Tag der Schule, die 4. KLässler kommen) ein Rechenprogramm. Nun gehen bei meinem Rechenprogramm alle Grundrechenarten bisauf die Division, da ich folgenden Probleme habe:
- Nur Zahlen aus dem kleinen Einmaleins (nicht: 14:4 sondern: 15:3)
- Größere Zahl zu erst (nicht: 3:15 sondern: 15:3)
Ich kriege diese Probleme einfach nicht hin. Es wäre echt schön, wenn man das bis in 27 h klären könnte, wenn es nicht klappt, dann ist auch nicht schlimm, dann kommt GUICtrlSetState($Radio4, $GUI_DISABLE)
PS: Der Zahlenbereich bezeichent die Zahlen vor dem Gleichzeichen (1+1=2)
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
#Region ### START Koda GUI section ### Form=C:\Users\Johannes Emich\Documents\AutoIt Projekte\LGG\Tag der Schule Rechenprogramm\Rechenprogramm.kxf
$Form1 = GUICreate("LGG Mathematik", 421, 359, 240, 166)
$Group1 = GUICtrlCreateGroup("1. Rechenarten", 16, 16, 145, 137)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Radio1 = GUICtrlCreateRadio("Addieren", 32, 48, 113, 17)
$Radio2 = GUICtrlCreateRadio("Subtrahieren", 32, 72, 113, 17)
$Radio3 = GUICtrlCreateRadio("Multiplizieren", 32, 96, 113, 17)
$Radio4 = GUICtrlCreateRadio("Dividieren", 32, 120, 113, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("2. Zahlenbereich", 16, 168, 145, 129)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
$Input1 = GUICtrlCreateInput("", 24, 192, 105, 23, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
GUICtrlSetFont(-1, 9, 800, 0, "Arial")
$Label1 = GUICtrlCreateLabel("bis", 24, 224, 121, 19)
$Input2 = GUICtrlCreateInput("", 24, 256, 105, 23, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
GUICtrlSetFont(-1, 9, 800, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Übernehmen", 16, 312, 147, 25, $WS_GROUP)
$Label2 = GUICtrlCreateLabel("Mathematikprogramm", 176, 24, 208, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Arial")
$Label3 = GUICtrlCreateLabel("Tag der Schule am LGG", 176, 56, 225, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Arial")
$Label4 = GUICtrlCreateLabel("", 200, 128, 101, 42)
GUICtrlSetFont(-1, 14, 400, 0, "Arial")
$Input3 = GUICtrlCreateInput("", 288, 128, 89, 26, $ES_AUTOHSCROLL)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Label5 = GUICtrlCreateLabel("Links kannst du die Rechenart und den Bereich deiner Zahlen festlegen", 208, 192, 157, 69, $SS_CENTER)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
$Button3 = GUICtrlCreateButton("Prüfen", 240, 280, 99, 41, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Überspringen", 256, 328, 67, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUICtrlSetLimit($Input1,3)
GUICtrlSetLimit($Input2,4)
GUICtrlSetState($Button3,$GUI_DISABLE)
GUICtrlSetState($Input1,$GUI_DISABLE)
GUICtrlSetState($Input2,$GUI_DISABLE)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Radio1 , $Radio2 , $Radio3 , $Radio4
If GUICtrlRead($Radio1) = $GUI_CHECKED Then
GUICtrlSetState($Input1,$GUI_ENABLE)
GUICtrlSetState($Input2,$GUI_ENABLE)
EndIf
If GUICtrlRead($Radio2) = $GUI_CHECKED Then
GUICtrlSetState($Input1,$GUI_ENABLE)
GUICtrlSetState($Input2,$GUI_ENABLE)
EndIf
If GUICtrlRead($Radio3) = $GUI_CHECKED Then
GUICtrlSetState($Input1,$GUI_ENABLE)
GUICtrlSetState($Input2,$GUI_ENABLE)
EndIf
If GUICtrlRead($Radio4) = $GUI_CHECKED Then
GUICtrlSetState($Input1,$GUI_ENABLE)
GUICtrlSetState($Input2,$GUI_ENABLE)
EndIf
Case $Button1
$zahlbereich1 = GUICtrlRead($Input1)
$zahlbereich2 = GUICtrlRead($Input2)
$zahl1 = Random($zahlbereich1,$zahlbereich2,1)
$zahl2 = Random($zahlbereich1,$zahlbereich2,1)
;Addieren
If GUICtrlRead($Radio1) = $GUI_CHECKED Then
GUICtrlSetData($Label4,$zahl1 & " + " & $zahl2 & " =")
$rechenart = "plus"
EndIf
;Subtrahieren
If GUICtrlRead($Radio2) = $GUI_CHECKED Then
$zahl2 = Random($zahlbereich1,$zahl1,1)
GUICtrlSetData($Label4,$zahl1 & " - " & $zahl2 & " =")
$rechenart = "minus"
EndIf
;Mal nehmen
If GUICtrlRead($Radio3) = $GUI_CHECKED Then
GUICtrlSetData($Label4,$zahl1 & " * " & $zahl2 & " =")
$rechenart = "mal"
EndIf
;Teilen
If GUICtrlRead($Radio4) = $GUI_CHECKED Then
; Hier komme ich nicht weiter, unten auch beim Prüfen Button
EndIf
GuiCtrlSetData($Label5,"")
GuiCtrlSetData($input3,"")
GUICtrlSetFont($Label5, 18, 800, 0, "Arial Black")
GUICtrlSetState($Button3,$GUI_ENABLE)
Case $Button3
$answer = GUICtrlRead($Input3)
If $rechenart = "plus" Then
If $zahl1 + $zahl2 = $answer Then
GUICtrlSetColor($Label5, 0x00FF00)
GuiCtrlSetData($Label5,"RICHTIG")
GUICtrlSetState($Input3,$GUI_DISABLE)
Sleep(1200)
GUICtrlSetState($Input3,$GUI_ENABLE)
$zahl1 = Random($zahlbereich1,$zahlbereich2,1)
$zahl2 = Random($zahlbereich1,$zahlbereich2,1)
GUICtrlSetData($Label4,$zahl1 & " + " & $zahl2 & " =")
GuiCtrlSetData($Label5,"")
GuiCtrlSetData($input3,"")
Else
GUICtrlSetColor($Label5, 0xFF0000)
GuiCtrlSetData($Label5,"FALSCH")
Sleep(1200)
GuiCtrlSetData($Label5,"")
GuiCtrlSetData($input3,"")
EndIf
EndIf
If $rechenart = "minus" Then
If $zahl1 - $zahl2 = $answer Then
GUICtrlSetColor($Label5, 0x00FF00)
GuiCtrlSetData($Label5,"RICHTIG")
GUICtrlSetState($Input3,$Gui_Disable)
Sleep(1200)
GUICtrlSetState($Input3,$Gui_Enable)
$zahl1 = Random($zahlbereich1,$zahlbereich2,1)
$zahl2 = Random($zahlbereich1,$zahl1,1)
GUICtrlSetData($Label4,$zahl1 & " - " & $zahl2 & " =")
GuiCtrlSetData($Label5,"")
GuiCtrlSetData($input3,"")
Else
GUICtrlSetColor($Label5, 0xFF0000)
GuiCtrlSetData($Label5,"FALSCH")
GUICtrlSetState($Input3,$Gui_Disable)
Sleep(1100)
GUICtrlSetState($Input3,$Gui_Enable)
GuiCtrlSetData($Label5,"")
GuiCtrlSetData($input3,"")
EndIf
EndIf
If $rechenart = "mal" Then
If $zahl1 * $zahl2 = $answer Then
GUICtrlSetColor($Label5, 0x00FF00)
GuiCtrlSetData($Label5,"RICHTIG")
GUICtrlSetState($Input3,$Gui_Disable)
Sleep(1200)
GUICtrlSetState($Input3,$Gui_Enable)
$zahl1 = Random($zahlbereich1,$zahlbereich2,1)
$zahl2 = Random($zahlbereich1,$zahlbereich2,1)
GUICtrlSetData($Label4,$zahl1 & " * " & $zahl2 & " =")
GuiCtrlSetData($Label5,"")
GuiCtrlSetData($input3,"")
Else
GUICtrlSetColor($Label5, 0xFF0000)
GuiCtrlSetData($Label5,"FALSCH")
GUICtrlSetState($Input3,$Gui_Disable)
Sleep(1100)
GUICtrlSetState($Input3,$Gui_Enable)
GuiCtrlSetData($Label5,"")
GuiCtrlSetData($input3,"")
EndIf
EndIf
#cs
If $rechenart = "teilen" Then
; hier ist es dasselbe
EndIf
#ce
EndSwitch
WEnd