Private Sub Command1_Click()
Dim a, b, ni, c, ok, nmax, test As Integer
Dim cc, result, sum, suml, bound, G As Single
Dim p(2, 2) As Single
Dim q(2) As Single
Dim s(2) As Single
Dim s1(2) As Single
Dim N, M, i, j As Single
N = 2
M = 2
c = 1
result = 0
ni = 0
For i = 1 To N
For j = 1 To M
p(i, j) = InputBox("请输入数据")
Print p(i, j)
Next j
Next i
sum = 0
For j = 1 To M
For i = 1 To N
sum = sum + p(i, j)
Next i
Next j
If sum > 1 Then
Print "输入信道矩阵不正确,请重新输入信道矩阵!"
c = 1
i = N
End If
c = 0
For i = 1 To N 'a请输入迭代计算精度:'
q(i) = 1# / N
Next i
For i = 1 To N
Next i
s(i) = q(i)
For j = 1 To M
s(j) = 0
For i = 1 To N
s(j) = s(j) + s(i) * p(i, j)
Next i
Next j
For j = 1 To M
For i = 1 To N
p(i, j) = s(i) * p(i, j) / s(j)
Next i
Next j
End Sub
VB程序总是下标越界.看看为什么!