Share via

VBScript addition

Brod Blox 1 Reputation point
2021-11-29T06:50:30.373+00:00

My code looks like this:
int a = InputBox("Enter Amount 1", "Calculator", "Number")
int b = InputBox("Enter Amount 2", "Calculator", "Number")
Mode = InputBox("Enter Mode. 1 is Add, 2 is Subtract, 3 is Multiply, and 4 is Divide.", "", "1, 2, 3, 4")
Select Case Mode
Case 1
c = a+b
Case 2
c = a-b
Case 3
c = a*b
Case 4
c = a/b
End Select

x = MsgBox("The answer is: " & c, 0, "Calculator")

But when ever I add the 2 a and b variables as both of them being 5, I get 55. This should only happen when I use the ampersand symbol, right? Is there any way to fix this issue?

Community Center | Not monitored
0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.