请回答下列问题:
Dim g1(201) As Integer, g2(201) As Integer
Dim xh(201) As Integer, xh2(201) As Integer
Const num = 101 '选考总人数
Dim n, m As Integer 'g1人数为n,g2人数为m
Private Sub Cd1_Click() '合并汇总
nu = num
Do While m >= 1
Do While
t = g1(nu): g1(nu) = g1(n): g1(n) = t
xh2(nu) = xh(2 * n - 1) : n = n – 1 : nu = nu - 1
Loop
t = g1(nu): g1(nu) = g2(m): g2(m) = g2(nu)
xh2(nu) = xh(2 * m) : nu = nu – 1 : m = m - 1
Loop
'处理学号
For i = 1 To n
Next i
'显示合并结果
For i = 1 To num
List3.AddItem xh2(i) & " " & g1(i)
Next i
'选出成绩第二好的同学
mxgrade = g1(num)
For i = num - 1 To 1 Step -1
If g1(i) <> mxgrade Then Exit For
Next i
If i<>0 Then
Label1.Caption = "学号为:" & xh2(i) & "的同学,本次测试成绩第二,分数为:" & g1(i)
End If
End Sub
Private Sub Command2_Click()
For i = 1 To num \ 2
'对g1同学的成绩进行排序
For j = 1 To num \ 2 - i + 1 * (num Mod 2)
If Then
t = g1(j): g1(j) = g1(j + 1): g1(j + 1) = t
t = xh(2 * j - 1): xh(2 * j - 1) = xh(2 * j + 1): xh(2 * j + 1) = t
End If
Next j
'对g2同学的成绩进行排序,代码略
Next i
'在列表框中输出g1和g2学生的学号及其对应的成绩,代码略
End Sub
Private Sub Form_Load()
'代码略,从数据库中导入所有选考学生数据,共num个人,并做如下处理:
'1.学号为奇数的同学录入g1班级,共n人
'2.学号为偶数的同学录入g2班级,共m人
End Sub