题型:综合题 题类:常考题 难易度:困难
浙江省湖州市菱湖中学2019届高三上学期信息技术12月月考试卷
实现上述功能的 VB 程序如下,但加框处代码有错,请改正。
Const n = 10
Dim a(1 To n) As Integer
Private Sub Command1_Click()
Dim i As Integer, j As Integer
Dim temp As Integer, flag As Boolean
'读取一组正整数,存储在数组a中,代码略
i = 1: j = n
temp = a(j): flag = True
Do While i < j
If flag Then
If a(i) Mod 2 = 0 Then
a(j) = a(i)
j=j-1
flag=Not flag
Else
'⑴
End If
Else
If a(j) Mod 2 = 1 Then
a(i)=a(j)
flag=Not flag
Else
j=j-1
End If
End If
Loop
'⑵
'依次输出排序后的数据,代码略。
End Sub
⑴ ⑵
试题篮