Hallo,
ich versuche gerde einen Durschnittsrechner zu programmieren, welches ich später unter Scripte posten möchte. Es ist eigentlich schon fast fertig aber irgendwie kommt da als Durchschnitt 45 o.ä raus obwohl ich 2 o.ä haben müsste. kann mir jemandh helfen?
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Durchschnitt Rechner", 254, 334)
$Label1 = GUICtrlCreateLabel("Deutsch:", 16, 32, 47, 17)
$Label2 = GUICtrlCreateLabel("Mathe:", 24, 56, 37, 17)
$Label3 = GUICtrlCreateLabel("Englisch:", 16, 80, 47, 17)
$Input1 = GUICtrlCreateInput("", 72, 32, 41, 21)
$Input2 = GUICtrlCreateInput("", 72, 56, 41, 21)
$Input3 = GUICtrlCreateInput("", 72, 80, 41, 21)
$Input4 = GUICtrlCreateInput("", 72, 104, 41, 21)
$Label4 = GUICtrlCreateLabel("© Burak K.", 100, 8, 98, 17)
$Label5 = GUICtrlCreateLabel("Erdkunde:", 8, 104, 53, 17)
$Input5 = GUICtrlCreateInput("", 72, 128, 41, 21)
$Label6 = GUICtrlCreateLabel("Wirtschaft:", 8, 128, 55, 17)
$Label7 = GUICtrlCreateLabel("Geschichte:", 2, 152, 61, 17)
$Input6 = GUICtrlCreateInput("", 72, 152, 41, 21)
$Input7 = GUICtrlCreateInput("", 72, 176, 41, 21)
$Input8 = GUICtrlCreateInput("", 72, 200, 41, 21)
$Label8 = GUICtrlCreateLabel("Sport:", 32, 176, 32, 17)
$Label9 = GUICtrlCreateLabel("Technik:", 16, 200, 46, 17)
$Label10 = GUICtrlCreateLabel("Religion:", 152, 32, 45, 17)
$Input9 = GUICtrlCreateInput("", 208, 32, 41, 21)
$Label11 = GUICtrlCreateLabel("Physik:", 160, 56, 38, 17)
$Input10 = GUICtrlCreateInput("", 208, 56, 41, 21)
$Input13 = GUICtrlCreateInput("", 208, 80, 41, 21)
$Input11 = GUICtrlCreateInput("", 208, 104, 41, 21)
$Label12 = GUICtrlCreateLabel("Musik:", 160, 104, 35, 17)
$Label13 = GUICtrlCreateLabel("Hauswirtschaft:", 120, 128, 77, 17)
$Input12 = GUICtrlCreateInput("", 208, 128, 41, 21)
$Label14 = GUICtrlCreateLabel("Bio:", 176, 152, 22, 17)
$Label15 = GUICtrlCreateLabel("Chemie:", 152, 80, 42, 17)
$Input14 = GUICtrlCreateInput("", 208, 152, 41, 21)
$Input15 = GUICtrlCreateInput("Durchschnitt", 64, 256, 121, 21, BitOR($ES_CENTER, $ES_AUTOHSCROLL))
$Label16 = GUICtrlCreateLabel("Dein Durchschnitt:", 0, 232, 252, 17, $SS_CENTER)
$Label17 = GUICtrlCreateLabel("Bewertung", 0, 280, 254, 17, $SS_CENTER)
$Button1 = GUICtrlCreateButton("ausrechnen", 88, 304, 75, 25, 0)
GUICtrlSetLimit($Input1, 1, 6)
GUICtrlSetLimit($Input2, 1, 6)
GUICtrlSetLimit($Input3, 1, 6)
GUICtrlSetLimit($Input4, 1, 6)
GUICtrlSetLimit($Input5, 1, 6)
GUICtrlSetLimit($Input6, 1, 6)
GUICtrlSetLimit($Input7, 1, 6)
GUICtrlSetLimit($Input8, 1, 6)
GUICtrlSetLimit($Input9, 1, 6)
GUICtrlSetLimit($Input10, 1, 6)
GUICtrlSetLimit($Input11, 1, 6)
GUICtrlSetLimit($Input12, 1, 6)
GUICtrlSetLimit($Input13, 1, 6)
GUICtrlSetLimit($Input14, 1, 6)
GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit]Local $div_1, $div_2, $div_3, $div_4, $div_5, $div_6, $div_7, $div_8, $div_9, $div_10, $div_11, $div_12, $div_13, $div_14
[/autoit] [autoit][/autoit] [autoit]$begin = TimerInit()
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$read_1 = GUICtrlRead($Input1)
$read_2 = GUICtrlRead($Input2)
$read_3 = GUICtrlRead($Input3)
$read_4 = GUICtrlRead($Input4)
$read_5 = GUICtrlRead($Input5)
$read_6 = GUICtrlRead($Input6)
$read_7 = GUICtrlRead($Input7)
$read_8 = GUICtrlRead($Input8)
$read_9 = GUICtrlRead($Input9)
$read_10 = GUICtrlRead($Input10)
$read_11 = GUICtrlRead($Input11)
$read_12 = GUICtrlRead($Input12)
$read_13 = GUICtrlRead($Input13)
$read_14 = GUICtrlRead($Input14)
If $read_1 = "" Or $read_1 = 0 Then
$read_1 = 0
$div_1 = 1
EndIf
If $read_2 = "" Or $read_2 = 0 Then
$read_2 = 0
$div_2 = 1
EndIf
If $read_3 = "" Or $read_3 = 0 Then
$read_3 = 0
$div_3 = 1
EndIf
If $read_4 = "" Or $read_4 = 0 Then
$read_4 = 0
$div_4 = 1
EndIf
If $read_5 = "" Or $read_5 = 0 Then
$read_5 = 0
$div_5 = 1
EndIf
If $read_6 = "" Or $read_6 = 0 Then
$read_6 = 0
$div_6 = 1
EndIf
If $read_7 = "" Or $read_7 = 0 Then
$read_7 = 0
$div_7 = 1
EndIf
If $read_8 = "" Or $read_8 = 0 Then
$read_8 = 0
$div_8 = 1
EndIf
If $read_9 = "" Or $read_9 = 0 Then
$read_9 = 0
$div_9 = 1
EndIf
If $read_10 = "" Or $read_10 = 0 Then
$read_10 = 0
$div_10 = 1
EndIf
If $read_11 = "" Or $read_11 = 0 Then
$read_11 = 0
$div_11 = 1
EndIf
If $read_12 = "" Or $read_12 = 0 Then
$read_12 = 0
$div_12 = 1
EndIf
If $read_13 = "" Or $read_13 = 0 Then
$read_13 = 0
$div_13 = 1
EndIf
If $read_14 = "" Or $read_14 = 0 Then
$read_14 = 0
$div_14 = 1
EndIf
$add = $read_1 + $read_2 + $read_3 + $read_4 + $read_5 + $read_6 + $read_7 + $read_8 + $read_9 + $read_10 + $read_11 + $read_12 + $read_13 + $read_14
$anzahl = $div_1 + $div_2 + $div_3 + $div_4 + $div_5 + $div_6 + $div_7 + $div_8 + $div_9 + $div_10 + $div_11 + $div_12 + $div_13 + $div_14
$div = 14 - $anzahl
$result = $add / $div
GUICtrlSetData($Input15, StringLeft($result, 5))
$note = StringLeft($result, 3)
If $note = 6 Then GUICtrlSetData($Label17, "Wie dumm bist du eigentlich?")
If $note = 5 Then GUICtrlSetData($Label17, "Schlecht, schlecht, schlecht ;(")
If $note = 4 Then GUICtrlSetData($Label17, "Naja gerade mal ausreichend :(")
If $note = 3 Then GUICtrlSetData($Label17, "Jaa geht noch.")
If $note = 2 Then GUICtrlSetData($Label17, "Das ist doch schonmal gut^^")
If $note = 1 Then GUICtrlSetData($Label17, "Perfekt")
;~ GUICtrlSetData($Label17, $note)
EndSwitch
WEnd