这个程序怎么会下标越界呢?急!
Dimi%,j%,n%n=Val(Text1.Text)ReDima(i,j)Fori=1TonPicture1.PrintSpc(n-i)Forj=1ToiIfi=1A...
Dim i%, j%, n%
n = Val(Text1.Text)
ReDim a(i, j)
For i = 1 To n
Picture1.Print Spc(n - i)
For j = 1 To i
If i = 1 And j <> 1 Then
a(i, j) = 1
End If
If i = j Then
a(i, j) = 1
End If
If i - 1 > 0 And j - 1 > 0 And i <> j Then
a(i, j) = a(i - 1, j - 1) + a(i - 1, j)
End If
t = a(i, j)
Picture1.Print t
Next j
Picture1.Print
Next i
End Sub
运行的时候怎么会下标越界呢? 展开
n = Val(Text1.Text)
ReDim a(i, j)
For i = 1 To n
Picture1.Print Spc(n - i)
For j = 1 To i
If i = 1 And j <> 1 Then
a(i, j) = 1
End If
If i = j Then
a(i, j) = 1
End If
If i - 1 > 0 And j - 1 > 0 And i <> j Then
a(i, j) = a(i - 1, j - 1) + a(i - 1, j)
End If
t = a(i, j)
Picture1.Print t
Next j
Picture1.Print
Next i
End Sub
运行的时候怎么会下标越界呢? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询