紧急求助 一道找不到错误的错题
紧急求助 一道找不到错误的错题Private Sub Form_Load()
Randomize
Label1.Caption = ""
Command1.Caption = "记分"
Text1.Text = ""
Picture1.BackColor = RGB(255, 255, 255)
Timer1.Interval = 1000
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then '按下回车
If Val(Text1.Text) = jg Then
Picture1.Print Label1.Caption; Text1.Text; Tab(10); "√"
r = r + 1
Else
Picture1.Print Label1.Caption; Text1.Text; Tab(10); "×"
w = w + 1
End If
Text1.Text = ""
Timer1.Enabled = True
End If
End Sub
Private Sub Timer1_Timer()
Dim n1%, n2%, fh$, fhdm%
n1 = Int(10 * Rnd + 1) '产生第一个数
n2 = Int(10 * Rnd + 1) '产生第二个数
fhdm = Int(4 * Rnd + 1) '产生运算符号
If fhdm = 1 Then
fh = "+": jg = n1 + n2
ElseIf fhdm = 2 Then
fh = "-": jg = n1 - n2
ElseIf fhdm = 3 Then
fh = "*": jg = n1 * n2
ElseIf fhdm = 4 Then
fh = "/": jg = n1 / n2
End If
Label1.Caption = n1 & fh & n2 & "="
Timer1.Enabled = False
Text1.SetFocus
End Sub
上面程序是计算机随机产生1-10 的数和运算符 + - * %
当学生输入答案 计算机判断答案并给出分数
大家看下 错在哪里
当我在文本里输入0或字符是 显示√
输入其他数字时显示×
大哥们 帮西啊忙啊