Private Sub command1_click() '出题
Randomize
Label1 = Int(Rnd * 9) + 1 '如果要两位数就把9改成99
Randomize
Label3 = Int(Rnd * 9) + 1
Select Case Int(Rnd * 4) + 1
Case 1
Label2 = "+"
Case 2
Label2 = "-"
Case 3
Label2 = "×"
Case 4
Label2 = "÷"
End Select
End Sub
Private Sub Command2_Click()
Select Case Label2.Caption
Case "+"
If Text1 = CInt(Label1) + CInt(Label3) Then
MsgBox "正确"
Else
MsgBox "错误"
End If
Case "-"
If Text1 = CInt(Label1) - CInt(Label3) Then
MsgBox "正确"
Else
MsgBox "错误"
End If
Case "×"
If Text1 = CInt(Label1) * CInt(Label3) Then
MsgBox "正确"
Else
MsgBox "错误"
End If
Case "÷"
If Text1 = CInt(Label1) / CInt(Label3) Then
MsgBox "正确"
Else
MsgBox "错误"
End If
End Select
End Sub