执行以下程序,单击命令按钮后,输出结果是______。Private Sub Command1_Click()Dim a(5) As IntegerDim bFor i = 1 To 5a(i) = i*iNext iFor Each b In aPrint b;Next bEnd Sub
查看答案
执行以下程序,单击命令按钮后,如果从键盘上输入5,则第一行输出结果是______,第二行输出结果是______。Private Sub Command1_Click()Dim a() As IntegerDim n As Integer, i As Integern =InputBox("input n:")ReDim a(n)For i = 1 To na(i) = 2*iPrint a(i);Next iPrintReDim a(10)For i =0 To 10Print a(i);Next iEnd Sub
执行下列程序,单击命令按钮在窗体上输出结果为______。Option Base 1Private Sub Command1_Click()Dim a(3, 3) As Integer, k As IntegerDim i As Integer, j As Integer, n As Integern = UBound(a, 1)For i = 1 To n - 2For j = i To n - ia(i, j) = k + 4a(j, n +1 - i) = k + 3a(n + 1- i, n + 1 - j) = k + 2a(n + 1 - j, i) = k + 1k = k + 4Next jNext iIf n Mod 2 <> 0 Thena((n + 1) / 2, (n + 1) / 2) = k + 1End IfPrint a(1, 2); a(2, 3); a(3, 3)End Sub
执行下面程序,第二行输出结果是______,第五行输出结果是______,第七行输出结果是______。Private Sub Command1_Click()Dim a(4, 5) As Integer, i As Integer, j As IntegerFor i = 1 To 4For j = 1 To 5a(i, j) = i * 8 + j - 1Print a(i, j);Next jPrintNext iFor i = 2 To 4a(i, i + 1) = a(i - 1, i) + 4Next iFor i = 1 To 4For j = 1 To 5Print a(i, j);Next jPrintNext iEnd Sub
执行下面程序,若依次输入1,2,3,4,5,6,则输出结果是______。Option Base 1Private Sub Command1_Click()Dim a(3, 2) As IntegerDim i%, j%, tFor i = 1 To 3For j = 1 To 2a(i, j) = InputBox("请输入数组元素的值")Next jNext iFor Each t In aPrint t;Next tEnd Sub