当前位置: 高中信息技术 / 综合题
  • 1. (2016·杭州模拟) 下列程序段实现对num数组进行排序,并将排序结果输出。

    Private Sub Command1Click()

    Dim num(0 To 5) As Integer

    Dim i As Integer, j As Integer

    Dim t As Integer

    num(0) = 4: num(1) = 7: num(2) = 2: num(3) = 0: num(4) = 3: num(5) = 9

    i = 0: j = 1: t = 0

    For i = 1 To 5 Step 1

      For j = i + 1 To 4 Step 1

      If num(i) > num(j) Then

      t = num(i)

      num(i) = num(j)

      num(j) = t

      End If

      Next j

    Next i

    For i = 1 To 5

    List1.AddItem num(i)

    Next i

    End Sub

    1. (1) 程序段中使用的排序算法是
    2. (2) 经过第一轮排序后num(2)的值是

微信扫码预览、分享更方便