之前用vb制作一个计算出题程序,结果总是在判题的时候报错,不知道是哪个细节出错了
以下代码
Dim a As Integer
Dim b As Integer
Dim c As Integer
Private Sub Command1_Click(Index As Integer)
Randomize
a = Int(Rnd * c)
Label1.Caption = a
b = Int(Rnd * c)
Label2.Caption = b
End Sub
Private Sub Command2_Click()
If Combo1.Text = "+" Then
If a + b = Text1.Text Then MsgBox "right", "vbokcancel", "答题结果" Else MsgBox "wrong", "vbokcancel", "答题结果"
End If
If Combo1.Text = "-" Then
If a - b = Text1.Text Then MsgBox "right", "vbokcancel", "答题结果" Else MsgBox "wrong", "vbokcancel", "答题结果"
End If
If Combo1.Text = "*" Then
If a * b = Text1.Text Then MsgBox "right", "vbokcancel", "答题结果" Else MsgBox "wrong", "vbokcancel", "答题结果"
End If
If Combo1.Text = "/" Then
If a / b = Text1.Text Then MsgBox "right", "vbokcancel", "答题结果" Else MsgBox "wrong", "vbokcancel", "答题结果"
End If
End Sub
Private Sub Form_Load()
Combo1.AddItem "+"
Combo1.AddItem "-"
Combo1.AddItem "*"
Combo1.AddItem "/"
c = Val(InputBox("请输入出题范围", "出题范围"))
End Sub
能否帮忙看看