题型:综合题 题类:常考题 难易度:普通
浙江省共美联盟2018-2019学年高二下学期信息技术期末模拟联考试卷
实现上述功能的 VB 程序如下,请回答下列问题:
Dim b(1 To 10) As Integer
Dim left1 As Integer, right1 As Integer Private Sub Cd1_Click()
Dim i As Integer, j As Integer
For i = 1 To 10
b(i) = Int(Rnd * 100) + 10 List1.AddItem Str(b(i))
Next i left1 = 1 right1 = 10
End Sub
Private Sub Cd2_Click()
Dim i As Integer, j As Integer, t As Integer
Do While left1 < right1
For j = left1 To right1 - 1
If b(j) > b(j + 1) Then
t = b(j): b(j) = b(j + 1): b(j + 1) = t
End If
Next j
For j = right1 To ‘改错
If b(j) < b(j - 1) Then
t = b(j): b(j) = b(j - 1): b(j - 1) = t end If
Next j
right1 = ‘填空
Loop
‘将排序结果显示在列表表框List2中,代码略
End Sub
试题篮