瑞星卡卡安全论坛

首页 » 技术交流区 » 系统软件 » 【讨论】vb编程的问题
天才gogogo - 2005-8-9 15:32:00
除法不知如何调试。



Dim s As Long, t As Long, a As Long, b As Long, p As Long
Private Sub Command5_Click()
End
End Sub
Private Sub Command6_Click()
t = 0
s = 0
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub form_load()
s = 0
t = 0
Randomize
End Sub
Private Sub command1_click()
Label1.Caption = "+"
If t > 0 Then
c = Val(Text3.Text)
If t < 11 Then If a + b = c Then s = s + 10
                Text6.Text = "答对了,加10分!"
                Text4.Text = "总分:" & s
                End If
If t < 11 Then If a + b <> c Then Text6.Text = "答错了,答案是" & (a + b)
t = t + 1
If t < 11 Then
Text5.Text = "第" & t & "题"
a = 10 + Int(Rnd * 90)
b = 10 + Int(Rnd * 90)
Text1.Text = a
Text2.Text = b
Text3.Text = ""
End If
If t = 11 Then
Text5.Text = "做完了"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End If
If t = 12 Then End
End Sub
Private Sub command2_click()
Label1.Caption = "-"
If t > 0 Then
c = Val(Text3.Text)
If t < 11 Then If a - b = c Then s = s + 10
                Text6.Text = "答对了,加10分!"
                Text4.Text = "总分:" & s
                End If
If t < 11 Then If a - b <> c Then Text6.Text = "答错了,答案是" & (a - b)
t = t + 1
If t < 11 Then
Text5.Text = "第" & t & "题"
a = 10 + Int(Rnd * 90)
b = 10 + Int(Rnd * 90)
If a < b Then
  a = b
  b = a
End If
Text1.Text = a
Text2.Text = b
Text3.Text = ""
End If
If t = 11 Then
Text5.Text = "做完了"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End If
If t = 12 Then End
End Sub
Private Sub command3_click()
Label1.Caption = "*"
If t > 0 Then
c = Val(Text3.Text)
If t < 11 Then If a * b = c Then s = s + 10
                Text6.Text = "答对了,加10分!"
                Text4.Text = "总分:" & s
                End If
If t < 11 Then If a * b <> c Then Text6.Text = "答错了,答案是" & (a * b)
t = t + 1
If t < 11 Then
Text5.Text = "第" & t & "题"
a = 10 + Int(Rnd * 90)
b = 1 + Int(Rnd * 9)
Text1.Text = a
Text2.Text = b
Text3.Text = ""
End If
If t = 11 Then
Text5.Text = "做完了"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End If
If t = 12 Then End
End Sub
Private Sub command4_click()
t = 1
Label1.Caption = "/"
If t < 11 Then
Text5.Text = "第" & t & "题"
a = 10 + Int(Rnd * 90)
b = 1 + Int(Rnd * 9)
a = a - (a Mod b)
Text1.Text = a
Text2.Text = b
Text3.Text = ""
End If
If t > 0 Then
c = Val(Text3.Text)
If t < 11 Then If a / b = c Then s = s + 10
                Text6.Text = "答对了,加10分!"
                Text4.Text = "总分:" & s
                End If
If t < 11 Then If a / b <> c Then Text6.Text = "答错了,答案是" & (a / b)
t = t + 1
If t = 11 Then
Text5.Text = "做完了"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End If
If t = 12 Then End
End Sub





1
查看完整版本: 【讨论】vb编程的问题