编写如下事件过程: Private Sub Form_Activate() Dim score(1To3)As Integer Dim i As Integer,t As Variant For i=3To1Step-1 score(i)=2*i Next

admin2019-06-20  20

问题 编写如下事件过程:
Private Sub Form_Activate()
Dim score(1To3)As Integer
Dim i As Integer,t As Variant
For i=3To1Step-1
score(i)=2*i
Next i
For Each t In score
Print t:
Next
End Sub
程序运行后窗体上显示(    )。

选项 A、6 4 2
B、2 4 6
C、2
D、6

答案B

解析 本题考查ForEachin循环。For Each in循环格式为:For Each变体变量in数组…Next,For Each in循环在本题中的功能是:依次从数组score中取出每一个元素放到变量t中并输出。数组score中的元素从1到3分别为:2 4 6。
转载请注明原文地址:https://kaotiyun.com/show/Z5Up777K
0

最新回复(0)