题型:综合题 题类:模拟题 难易度:普通
浙江省2019年信息技术选考模拟试卷二
实现上述功能的VB程序如下:
Dim a(1 To 20) As Integer
Dim n As Integer
Private Sub Text1_KeyPress(KeyAscii As Integer)
‘将输入各队员身高分别存入数组a中,队员个数为n,代码略!
End Sub
Private Sub Command1_Click()
Dim c(1 To 20) As Integer
Dim right As Integer, left As Integer, i As Integer
For i = 1 To n – 1
For j =1 To n-i
If ① Then
t = (j): a(j) = a(j + 1): a(j + 1) = t
End If
Next j
Next i
‘下列程序段实现数组C的合唱队列
m = (1 + n) \ 2
left = m: right = m
c(m) = a(n)
i = 2
Do While i <= n
If i Mod 2 = 0 Then
right = right + 1
c(right) = a(n-i+1)
Else
②
c(left) = a(n-i+1)
End If
i = i + 1
Loop
s = ③
For i = 2 To n
s = s + "," + Str(c(i))
Next i
Text2.Text = s
End Sub
以上程序段运行时,为了实现上述功能,划线处应填入的代码为:
① ; ②; ③。
试题篮