MorganFish
2022-04-02 11:39
采纳率: 80%
浏览 12
已结题

vb6计算出题器报错

之前用vb制作一个计算出题程序,结果总是在判题的时候报错,不知道是哪个细节出错了

img

以下代码
Dim a As Integer
Dim b As Integer
Dim c As Integer
Private Sub Command1_Click(Index As Integer)
Randomize
a = Int(Rnd * c)
Label1.Caption = a
b = Int(Rnd * c)
Label2.Caption = b
End Sub
Private Sub Command2_Click()
If Combo1.Text = "+" Then
 If a + b = Text1.Text Then MsgBox "right", "vbokcancel", "答题结果" Else MsgBox "wrong", "vbokcancel", "答题结果"
End If
If Combo1.Text = "-" Then
 If a - b = Text1.Text Then MsgBox "right", "vbokcancel", "答题结果" Else MsgBox "wrong", "vbokcancel", "答题结果"
End If
If Combo1.Text = "*" Then
 If a * b = Text1.Text Then MsgBox "right", "vbokcancel", "答题结果" Else MsgBox "wrong", "vbokcancel", "答题结果"
End If
If Combo1.Text = "/" Then
 If a / b = Text1.Text Then MsgBox "right", "vbokcancel", "答题结果" Else MsgBox "wrong", "vbokcancel", "答题结果"
End If
End Sub
Private Sub Form_Load()
Combo1.AddItem "+"
Combo1.AddItem "-"
Combo1.AddItem "*"
Combo1.AddItem "/"
c = Val(InputBox("请输入出题范围", "出题范围"))
End Sub
能否帮忙看看
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题