下标越界dim .for i = 1 to 7for j = 1 to 7 if i = 1 or j = 1 then a(i,j)=1elsea(i,j) =a(i-1,j-1)+a(i-1,j)end ifnext j next ifor i= 1 to7for j= 1 to iprint a(i,j)next j printnext i .运行说是下标越界 a(i,j) =a(i-1,j-1

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/28 23:58:39
下标越界dim .for i = 1 to 7for j = 1 to 7 if i = 1 or j = 1 then a(i,j)=1elsea(i,j) =a(i-1,j-1)+a(i-1,j)end ifnext j next ifor i= 1 to7for j= 1 to iprint a(i,j)next j printnext i .运行说是下标越界 a(i,j) =a(i-1,j-1
xSOO@*H#Hz`!1&\D.ewP )x$ƈ"l&jɞM̦b2RN|gޔ캮}y7(Ռc7 gsh Ŋ YJ߅gM5F%)-k5M5C/%df&34ڞA(%eI ab? a ܻmy7=ҏi$gG@m7A *HB~P uv7 EҡTb 1@z6=c}u4h;jcߵJQ8Nx]~Ÿpf]v[@ay0ZX*) kMf0Y _{e%9r%;jƶq7%;E' AdfC)D&dg,rz$R*/hto%?5;fSgx<[

下标越界dim .for i = 1 to 7for j = 1 to 7 if i = 1 or j = 1 then a(i,j)=1elsea(i,j) =a(i-1,j-1)+a(i-1,j)end ifnext j next ifor i= 1 to7for j= 1 to iprint a(i,j)next j printnext i .运行说是下标越界 a(i,j) =a(i-1,j-1
下标越界
dim .
for i = 1 to 7
for j = 1 to 7
if i = 1 or j = 1 then a(i,j)=1
else
a(i,j) =a(i-1,j-1)+a(i-1,j)
end if
next j
next i
for i= 1 to7
for j= 1 to i
print a(i,j)
next j
print
next i
.
运行说是下标越界 a(i,j) =a(i-1,j-1)+a(i-1,j) 说是这句话 不懂怎么错的啊 求教

下标越界dim .for i = 1 to 7for j = 1 to 7 if i = 1 or j = 1 then a(i,j)=1elsea(i,j) =a(i-1,j-1)+a(i-1,j)end ifnext j next ifor i= 1 to7for j= 1 to iprint a(i,j)next j printnext i .运行说是下标越界 a(i,j) =a(i-1,j-1
问题一定出在数组的dim上,帮你完整地写了一下:
Private Sub Command1_Click()
Dim a(7, 7) As Integer
For i = 1 To 7
For j = 1 To 7
If i = 1 Or j = 1 Then
a(i, j) = 1
Else
a(i, j) = a(i - 1, j - 1) + a(i - 1, j)
End If
Next j
Next i
For i = 1 To 7
For j = 1 To i
Print a(i, j);
Next j
Print
Next i
End Sub