Option Explicit Dim aa$, i&, S
Private Sub Command1_Click() Randomize
'******************** 随机四则运算 aa = \"\": S = Array(\"+\ For i = 0 To 8
If i Mod 2 = 0 Then
aa = aa & Int(Rnd * 100) + 1 '1-100的随机数 Else
aa = aa & S(Int(Rnd * 4)) '+-*/的随机数 End If Next i
Text1.Text = aa & \" = \" & CStr(WZcalc(aa)) End Sub
Public Function WZcalc(Tmpstr$) As Double '文字计算式 Dim SC As Object
Set SC = CreateObject(\"ScriptControl\") SC.Language = \"VBScript\" WZcalc = SC.Eval(Tmpstr) Set SC = Nothing End Function
因篇幅问题不能全部显示,请点此查看更多更全内容