题型:综合题 题类:常考题 难易度:普通
浙江省嘉兴市第一中学2020届高三上学期信息技术期中考试试卷
当窗体Form1加载时,自动产生a、b数组的数据,并分别显示在列表框List1与List2中,单击合并按钮Command1后,在c数组中保存按规则合并后的a、b数组的数据,并显示在列表框List3中。程序截图如下所示:
实现该功能的VB程序如下:
Const m = 5
Const n = 6
Dim a(1 To m) As Integer
Dim b(1 To n) As Integer
Dim c(1 To m + n) As Integer
‘窗体加载时,生成数组a、b中的数据,并按要求排序后显示在列表框中,代码略
Private Sub Command1_Click()
Dim pa As Integer, pb As Integer, pc As Integer, s As Integer, flag As Boolean
pa = m: pb = 1: pc = 1
flag = True
Do While ①
If a(pa) < b(pb) Then
s = a(pa)
pa = pa - 1
Else
s = b(pb)
pb = pb + 1
End If
c(pc) = s
If flag Then
pc = m + n - pc + 1
Else
pc =
End If
②
Loop
‘处理a、b数组中剩余数据,并在列表框List3中输出数组c,代码略
End Sub
试题篮