(相关资料图)
1、Dim s(2) As StringDim a As IntegerDim b As IntegerDim c As StringDim d As StringPrivate Sub Form_Load()Randomize Dim z As Integer For z = 1 To 15 a = Int(90 * Rnd + 0) b = Int(90 * Rnd + 0) s(1) = "+" s(2) = "-"c = Int((Rnd * 2) + 1)If c = 1 ThenDo While a + b > 100 a = Int(90 * Rnd + 0) b = Int(90 * Rnd + 0) Loop End IfIf c = 2 ThenDo While a - b < 0a = Int(90 * Rnd + 0)b = Int(90 * Rnd + 0)LoopEnd Ifd = Str(a) & s(c) & Str(b)Text1.Text = ""Select Case s(c)Case "+" List1.AddItem Str(a) & s(c) & Str(b) & "=" & (a + b)Case "-" List1.AddItem Str(a) & s(c) & Str(b) & "=" & (a - b)End SelectNext zEnd Sub。
本文就为大家分享到这里,希望看了会喜欢。
标签: