关于VB6.0的变量声明的简单问题!
来源:百度知道 编辑:UC知道 时间:2024/07/02 18:31:02
楼上在写C哦, 呵呵...
其实不管精简版不精简版, 语法是一样的:
Dim x As Integer, y As Integer, z As Integer
符号可以和上面一样定义, 也可以用布尔值.
写了一个试试:
Private Sub Command1_Click()
Dim x As Integer, y As Integer, z As Integer
Dim op(1 To 2) As Boolean '设True为加, False为减
Dim sOut As String
Dim i As Integer
Do While i < 10 '10改为题目数
Randomize
x = Int(101 * Rnd)
y = Int(101 * Rnd)
z = Int(101 * Rnd)
op(1) = Int(2 * Rnd)
op(2) = Int(2 * Rnd)
If x + IIf(op(1), 1, -1) * y + IIf(op(2), 1, -1) * z > 0 Then
sOut = sOut & vbCrLf & x & IIf(op(1), " + ", " - ") & y & IIf(op(2), " + ", " - ") & z
i = i + 1
End If
Loop
MsgBox sOut
End Sub
int x,y,z
char m,n(做加减号用)
给x,y,z做随机生成