一道VB运行结果题,答案已知,求解释运行过程,麻烦详细一点
2个回答
展开全部
Option Explicit
Option Base 1
Private Sub Command1_Click()
Dim i As Integer, j As Integer, m As Integer, a() As Integer
m = 4
ReDim a(m, m)
For i = 1 To m
a(1, i) = (m - i + 1) ^ 2 '把计算结果放入二维数组第一行的各列中
Next '16 9 4 1
For i = 2 To m
For j = 1 To m - 1
a(i, j) = a(i - 1, j + 1) '把当前行前3列的数据前移一列并放入下一行前三列
Next
a(i, j) = a(i - 1, 1) '把前一行第一列数所放入下一行的第4列
Next
For i = 1 To m
For j = 1 To m
Debug.Print a(i, j);
Next
Debug.Print
Next
End Sub
for j=1 to m-1 等于 for j=1 to 3,当j循环全部循环完后,j的值为4
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询