Private Sub Command2_Click() '检查答案的正误
If Val(Text1) = result1 Then
Label14 = "√"
Else
Label14 = "×"
End If
If Val(Text2) = result2 Then
Label15 = "√"
Else
Label15 = "×"
End If
If Val(Text3) = result3 Then
Label16 = "√"
Else
Label16 = "×"
End If
If Val(Text4) = result4 Then
Label17 = "√"
Else
Label17 = "×"
End If
If Val(Text5) = result5 Then
Label18 = "√"
Else
Label18 = "×"
End If
If Val(Text6) = result6 Then
Label19 = "√"
Else
Label19 = "×"
End If
If Val(Text7) = result7 Then
Label20 = "√"
Else
Label20 = "×"
End If
If Val(Text8) = result8 Then
Label21 = "√"
Else
Label21 = "×"
End If
If Val(Text9) = result9 Then
Label22 = "√"
Else
Label22 = "×"
End If
If Val(Text10) = result10 Then
Label23 = "√"
Else
Label23 = "×"
End If
If Val(Text11) = result11 Then
Label24 = "√"
Else
Label24 = "×"
End If
If Val(Text12) = result12 Then
Label25 = "√"
Else
Label25 = "×"
End If
End Sub
Private Sub Command3_Click() '开始新一轮的练习
Call Command3_Click
End Sub
Private Sub Command4_Click()
Call CCCS1
Label2 = n1 & B & n2 & "="
Call JJCS1
Label3 = n1 & B & n2 & "="
Call JJCS2
Label4 = n1 & B & n2 & "="
Call CCCS2
Label5 = n1 & B & n2 & "="
Call JJCS3
Label6 = n1 & B & n2 & "="
Call CCCS3
Label7 = n1 & B & n2 & "="
Call JJCS4
Label8 = n1 & B & n2 & "="
Call JJCS5
Label9 = n1 & B & n2 & "="
Call CCCS4
Label10 = n1 & B & n2 & "="
Call JJCS6
Label11 = n1 & B & n2 & "="
Call CCCS5
Label12 = n1 & B & n2 & "="
Call CCCS6
Label13 = n1 & B & n2 & "="
End Sub
Sub CCCS1()
Randomize
A = Int(Rnd * 2 + 1)
Select Case A
Case 1
B = "+"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
result1 = n1 + n2
Case 2
B = "-"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
If n1 < n2 Then n3 = n1: n1 = n2: n2 = n3
result1 = n1 - n2
End Select
End Sub
Sub JJCS1()
Randomize
A = Int(Rnd * 2 + 1)
Select Case A
Case 1
B = "×"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
result2 = n1 * n2
Case 2
B = "÷"
n2 = Int(Rnd * 9 + 1)
n1 = Int(Rnd * 10 + 0) * n2
result2 = n1 / n2
End Select
End Sub
Sub JJCS2()
Randomize
A = Int(Rnd * 2 + 1)
Select Case A
Case 1
B = "+"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
result3 = n1 + n2
Case 2
B = "-"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
If n1 < n2 Then n3 = n1: n1 = n2: n2 = n3
result3 = n1 - n2
End Select
End Sub
Sub CCCS2()
Randomize
A = Int(Rnd * 2 + 1)
Select Case A
Case 1
B = "×"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
result4 = n1 * n2
Case 2
B = "÷"
n2 = Int(Rnd * 9 + 1)
n1 = Int(Rnd * 10 + 0) * n2
result4 = n1 / n2
End Select
End Sub
Sub JJCS3()
Randomize
A = Int(Rnd * 2 + 1)
Select Case A
Case 1
B = "+"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
result5 = n1 + n2
Case 2
B = "-"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
If n1 < n2 Then n3 = n1: n1 = n2: n2 = n3
result5 = n1 - n2
End Select
End Sub
Sub CCCS3()
Randomize
A = Int(Rnd * 2 + 1)
Select Case A
Case 1
B = "×"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
result6 = n1 * n2
Case 2
B = "÷"
n2 = Int(Rnd * 9 + 1)
n1 = Int(Rnd * 10 + 0) * n2
result6 = n1 / n2
End Select
End Sub
Sub JJCS4()
Randomize
A = Int(Rnd * 2 + 1)
Select Case A
Case 1
B = "+"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
result7 = n1 + n2
Case 2
B = "-"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
If n1 < n2 Then n3 = n1: n1 = n2: n2 = n3
result7 = n1 - n2
End Select
End Sub
Sub JJCS5()
Randomize
A = Int(Rnd * 2 + 1)
Select Case A
Case 1
B = "×"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
result8 = n1 * n2
Case 2
B = "÷"
n2 = Int(Rnd * 9 + 1)
n1 = Int(Rnd * 10 + 0) * n2
result8 = n1 / n2
End Select
End Sub
Sub CCCS4()
Randomize
A = Int(Rnd * 2 + 1)
Select Case A
Case 1
B = "+"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
result9 = n1 + n2
Case 2
B = "-"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
If n1 < n2 Then n3 = n1: n1 = n2: n2 = n3
result9 = n1 - n2
End Select
End Sub
Sub JJCS6()
Randomize
A = Int(Rnd * 2 + 1)
Select Case A
Case 1
B = "×"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
result10 = n1 * n2
Case 2
B = "÷"
n2 = Int(Rnd * 9 + 1)
n1 = Int(Rnd * 10 + 0) * n2
result10 = n1 / n2
End Select
End Sub
Sub CCCS5()
Randomize
A = Int(Rnd * 2 + 1)
Select Case A
Case 1
B = "+"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
result11 = n1 + n2
Case 2
B = "-"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
If n1 < n2 Then n3 = n1: n1 = n2: n2 = n3
result11 = n1 - n2
End Select
End Sub
Sub CCCS6()
Randomize
A = Int(Rnd * 2 + 1)
Select Case A
Case 1
B = "×"
n1 = Int(Rnd * 10 + 1)
n2 = Int(Rnd * 10 + 1)
result12 = n1 * n2
Case 2
B = "÷"
n2 = Int(Rnd * 9 + 1)
n1 = Int(Rnd * 10 + 0) * n2
result12 = n1 / n2
End Select
End Sub
运行后的界面就成了这样了