编写如下事件过程: Pate Sub Form Activate( ) Dim score(1 To 3)As Integer Dim i As Integer,t As Variant For i=3 To 1 Step-1 score(i)=2

admin2020-02-27  16

问题 编写如下事件过程:
Pate Sub Form Activate(     )
Dim score(1 To 3)As Integer
Dim i As Integer,t As Variant
For i=3 To 1 Step-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

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

最新回复(0)