自动生成随机自则运算出错,求高手指教,
Dim a, b, c, d, e, f, g, m As Integer, r, s, t As Variant ,定义变量-----------------------------------------------------------------------
Private Sub Command1_Click() ,生成四则运算
x = a & r & b & s & c & t & d
Print x ,打印出四则运算
End Sub
--------------------------------------
Private Sub Command2_Click() ,结果检验
m = Val(Text1.Text) ,输入运算结果
If x = m Then ,比较电脑运算结果和自己运算结果
MsgBox "你算对了"
ElseIf m <> x Then
MsgBox "你算错了"
End If
End Sub
------------------------------
Private Sub Form_Load()
Randomize
a = Int(50 * Rnd) ,产生随机数a
b = Int(100 * Rnd) ,产生随机数b
c = Int(20 * Rnd) ,产生随机数c
d = Int(30 * Rnd) ,产生随机数d
e = Int(3 * Rnd + 1)
f = Int(3 * Rnd + 1)
g = Int(3 * Rnd + 1)
r = Choose(e, "+", "-", "*", "/") ,产生随机运算符
s = Choose(f, "+", "-", "*", "/") ,产生随机运算符
t = Choose(g, "+", "-", "*", "/") ,产生随机运算符
为什么电脑不运算X呢,,