# Calculator

## Recommended Posts

Hi.

I did a calculator.

(okay, if u have better dont need to post)

I know bug: u can write letters too, but i dont know how to fix it.So if you know, how to, pls write.

```#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
\$Form1 = GUICreate("Calculator", 367, 210, 192, 124)
\$Input1 = GUICtrlCreateInput("", 32, 51, 121, 21)
\$Input2 = GUICtrlCreateInput("", 195, 50, 121, 21)
\$Button1 = GUICtrlCreateButton("=", 79, 108, 182, 25, 0)
\$Input3 = GUICtrlCreateInput("", 110, 148, 121, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
\$nMsg = GUIGetMsg()
Switch \$nMsg
Case \$GUI_EVENT_CLOSE
Exit
Case \$Button1
If \$kivon = 1 Then
kivonas()
EndIf

EndIf

If \$szoroz = 1 Then
szorzas()
EndIf

If \$oszt = 1 Then
osztas()
EndIf

If \$kivon + \$osszead + \$szoroz + \$oszt = 0 Then
msgbox(0, "Error", "Choose from any radio buttons!")
EndIf
EndSwitch
WEnd
Func kivonas()
\$kivonasss = \$put1 - \$put2
GuiCtrlSetData (\$Input3, \$kivonasss)
EndFunc
EndFunc
Func szorzas()
\$szorzasss = \$put1 * \$put2
GuiCtrlSetData (\$Input3, \$szorzasss)
EndFunc
Func osztas()
\$osztasss = \$put1 / \$put2
GuiCtrlSetData (\$Input3, \$osztasss)
EndFunc```
##### Share on other sites

Hi.

I did a calculator.

(okay, if u have better dont need to post)

I know bug: u can write letters too, but i dont know how to fix it.So if you know, how to, pls write.

`\$Input3 = GUICtrlCreateInput("", 110, 148, 121, 21,\$ES_NUMBER)`
Edited by JohnOne

Monkey's are, like, natures humans.

Thx!

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...