这样可以了吗:
呵呵,挣这100分真不容易啊
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Dim k As Integer
Dim iTime As Long
Dim iStar As Boolean
Private Function getIssue() As Integer
'************加减乘除四则运算************************************************************************
Dim a As Integer, b As Integer, OP As String, m As String
OP = "+-×÷"
Randomize
a = Int(Rnd * 101)
b = Int(Rnd * 101)
For i = 1 To 1
m = Mid(OP, Int(Rnd * 2) + 1, 1) '在调试时,这里的4改成3,2,1等表示去掉对应的运算符
If m = "÷" And b = 0 Then i = i - 1
Next
Label1.Caption = a & " " & m & " " & b & " = "
Text1.Text = ""
Select Case m
Case "+"
getIssue = a + b
Case "-"
getIssue = a - b
Case "×"
getIssue = a * b
Case "÷"
getIssue = Round(a / b, 2) '四舍五入保留两位小数
End Select
'**************************************************************************************************
End Function
Private Sub Form_Activate()
iStar = False
Text1.Text = "按1键开始"
Text1.SetFocus
End Sub
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
If Not iStar Then
If KeyCode = 49 Then
iStar = True
k = getIssue()
iTime = timeGetTime()
End If
Else
If Val(Trim(Text1.Text)) = k Then
List1.AddItem Label1.Caption & k & " : " & Format((timeGetTime() - iTime) / 1000, " 0.00") & "秒"
k = getIssue()
iTime = timeGetTime
End If
End If
End Sub
看“我的消息”。
e.......