程序运行界面如图所示,左边列表框List1中显示数据(成绩和姓名),单击 “开始排序”按钮(Command1),排序后的结果按成绩从高到低显示在列表框List2中。
解决此问题的排序部分的程序段如下:
Dim m(1 To 10) As Single
Dim name(1 To 10) As String
Private Sub Command1_Click( )
Dim i As Integer, j As Integer, k As Integer, x As Single, y As String
For i = 1 To 9
k = i
For j = i + 1 To 10
If ① Then k = j
Next j
If k <> i Then
x = m(i) : m(i) = m(k) : ②
y = name (i) : name (i) = name (k) : name (k) = y
End If
Next I
For I = 1 To 10
List2.AddItem Str(m(i)) + " " + name(i)
Next i
End Sub
Private Sub Form_Load()
' 此过程用于对数组a和数组b进行初始赋值,代码略
End Sub
在程序①和②划线处,填入适当的语句或表达式,把程序补充完整: