Private Sub command1_click() "出題
Randomize
Label1 = Int(Rnd * 9) + 1 "如果要兩位數就把9改成99
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
Case "×"
If Text1 = CInt(Label1) * CInt(Label3) Then
Case "÷"
If Text1 = CInt(Label1) / CInt(Label3) Then
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