如何使用排除法求数组中的一个数?
各位大虾,
已知数字A和B,我想用排除法求数组X0-X8中的一个,执行程序后,总是出现一些问题,总之, 程序肯定有点问题,请各位大虾检查一下,看看问题出在哪里? 拜托了!
我的邮箱:ycg0722@yahoo.com.cn
程序如下:
Private Sub Command1_Click()
Dim B As Double
Dim A As Double
Dim W As Double
Dim I As Integer
For I = 0 To 10
Dim X(10) As Variant
X(0) = 5
X(1) = 10
X(2) = 15
X(3) = 20
X(4) = 25
X(5) = 30
X(6) = 35
X(7) = 40
X(8) = 45
A = Val(Text1.Text)
B = Val(Text2.Text)
Do While A = B + X(I)
W = X(I)
I = MsgBox("X=" & W, 2 + 256 + 64)
Loop
Next I
Exit Sub
End Sub
: