关于VB的一个编程问题

来源:百度知道 编辑:UC知道 时间:2024/05/21 22:05:58
输入任意两个数字,和任意的运算符“+ - * /”中的一个,要求写出运算结果。
使用 inputbox 输入, print 输出
select case 完成对符号的判断
小弟初学,请高手赐教。
谢谢

Private Sub Form_Click()
a = Val(InputBox("Input the first number"))

If a = "" Then
End
End If

op = InputBox("Input the option")
If op = "" Then
End
End If
b = Val(InputBox("Input the second number"))
If b = "" Then
End
End If
Select Case op
Case "+"
result = a + b
Case "-"
result = a - b
Case "*"
result = a * b
Case "/"
result = a / b
Case Else
MsgBox "your Input is not right"
End Select
Print result
End Sub