Option Explicit
Private a As Integer, b As Integer, c As Integer, d As Integer, e As Integer, f As Integer
Private Sub Command1_Click()
If Command1.Caption = "回答" Then
Command1.Caption = "出题"
Picture2.Cls
If Val(Text1.Text) = d Then
Picture2.Print "√"
e = e + 1
Else
Picture2.Print "×"
f = f + 1
End If
Picture2.Print "正确:" & e & ",错误:" & f
Else
Command1.Caption = "回答"
Text1.Text = ""
Picture1.Cls
a = Int(1 + 9 * Rnd)
b = Int(1 + 9 * Rnd)
c = Int(4 * Rnd)
If c = 1 Then
Picture1.Print a & "+" & b & "="
d = a + b
ElseIf c = 2 Then
Picture1.Print a & "-" & b & "="
d = a - b
ElseIf c = 3 Then
Picture1.Print a & "×" & b & "="
d = a * b
Else
Do
a = Int(1 + 9 * Rnd)
b = Int(1 + 9 * Rnd)
Loop Until a Mod b = 0
Picture1.Print a & "÷" & b & "="
d = Int(a / b)
End If
End If
End Sub
'四则运算时除法一定要能整除