我的这个程序在vb中运行时为什么总是显示实时错误“11”:除数为零
PrivateSubCommand1_Click()DimiAsInteger,aAsInteger,bAsIntegerDimsAsStringMe.ClsRandom...
Private Sub Command1_Click()
Dim i As Integer, a As Integer, b As Integer
Dim s As String
Me.Cls
Randomize
For i = 1 To 20
a = 100 * Rnd
b = (100 - a) * Rnd
Me.Print a & "+" & b & "="
Me.Print a & "*" & b & "="
If a > b And b > 0 And a Mod b = 0 Then
Me.Print a & "/" & b & "="
End If
If b > a And a > 0 And b Mod a = 0 Then
Me.Print b & "/" & a & "="
End If
If a > b Then
Me.Print a & "-" & b & "="
Else
Me.Print b & "-" & a & "="
End If
Next i
End Sub 展开
Dim i As Integer, a As Integer, b As Integer
Dim s As String
Me.Cls
Randomize
For i = 1 To 20
a = 100 * Rnd
b = (100 - a) * Rnd
Me.Print a & "+" & b & "="
Me.Print a & "*" & b & "="
If a > b And b > 0 And a Mod b = 0 Then
Me.Print a & "/" & b & "="
End If
If b > a And a > 0 And b Mod a = 0 Then
Me.Print b & "/" & a & "="
End If
If a > b Then
Me.Print a & "-" & b & "="
Else
Me.Print b & "-" & a & "="
End If
Next i
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询