计算器vb小程序
- 格式:doc
- 大小:25.00 KB
- 文档页数:3
Select Case Index
Case 0
Select Case m
Case "+"
Text1.Text = num1 + num2
Case "-"
Text1.Text = num2 - num1
Case "*"
Text1.Text = num1 * num2
Case "/"
Text1.Text = num2 / num1
End Select
t = 0
num2 = Text1.Text
Case 1
t = t + 1
If t = 1 Then
num1 = Text1.Text
num2 = num1
m = "+"
Text1.Text = "+"
Else
Select Case m
Case "+"
Text1.Text = num1 + num2
Case "-"
Text1.Text = num2 - num1
Case "*"
Text1.Text = num1 * num2
Case "/"
Text1.Text = num2 / num1
End Select
m = "+"
num2 = Text1.Text
End If
Case 2
t = t + 1
If t = 1 Then
num1 = Text1.Text
num2 = num1
m = "-"
Text1.Text = "-"
Else
Select Case m
Case "+"
Text1.Text = num1 + num2
Case "-"
Text1.Text = num2 - num1
Case "*"
Text1.Text = num1 * num2
Case "/"
Text1.Text = num2 / num1
End Select
m = "-"
num2 = Text1.Text
End If
Case 3
t = t + 1
If t = 1 Then
num1 = Text1.Text
num2 = num1
m = "*"
Text1.Text = "*"
Else
Select Case m
Case "+"
Text1.Text = num1 + num2
Case "-"
Text1.Text = num2 - num1
Case "*"
Text1.Text = num1 * num2
Case "/"
Text1.Text = num2 / num1
End Select
m = "*"
num2 = Text1.Text
End If
Case 4
t = t + 1
If t = 1 Then
num1 = Text1.Text
num2 = num1
m = "/"
Text1.Text = "+"
Else
Select Case m
Case "/"
Text1.Text = num1 + num2
Case "-"
Text1.Text = num2 - num1
Case "*"
Text1.Text = num1 * num2
Case "/"
Text1.Text = num2 / num1
End Select
m = "/"
num2 = Text1.Text
End If
End Select