Skip to content

Instantly share code, notes, and snippets.

@fearoffish
Forked from anonymous/Calculator
Last active December 16, 2015 20:29
Show Gist options
  • Save fearoffish/5492701 to your computer and use it in GitHub Desktop.
Save fearoffish/5492701 to your computer and use it in GitHub Desktop.
Module Module1
Sub Main()
Dim intNumber1, intNumber2 as Integer
Dim strOperator As String
Do
strOperator = InputBox("Please choose an operator to use: +, -, *. Or type Q to quit.")
If strOperator = "Q" Then Exit
intNumber1 = InputBox("Please Enter The Value For The First Number")
intNumber2 = InputBox("Please Enter The Value For The Second Number")
If strOperator = "+" Then Call Add(Number1, Number2)
If strOperator = "-" Then Call Subtract(Number1, Number2)
If strOperator = "*" Then Call Multiply(Number1, Number2)
Loop
End Sub
Sub Add(ByVal Number1, ByVal Number2)
MsgBox("The Total is " & (Number1 + Number2))
End Sub
Sub Subtract(ByVal Number1, ByVal Number2)
MsgBox("The Result Of Subtraction Is " & (Number1 - Number2))
End Sub
Sub Multiply(ByVal Number1, ByVal Number2)
MsgBox("The Result Of Multiply is " & (Number1 * Number2))
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment