在程序划线处填入合适代码
Dim Group_ score(0 To 24) As Single
Dim Group _name(1 To 24) As String
Dim flag(1 To 24) As Integer
Dim Finals_ name(1 To 8) As String '参加决赛名单
Dim Finals_ score(1 To 8) As Single '参加决赛的预赛成绩
Dim First As Integer, second1 As Integer
Private Sub Form Load ()
'读取三个小组的运动员姓名和预赛成绩(不存在相同成绩),分别存放在Group_ name
'和Group_ score 数组,其中Group_ name(1) 到Group_ name(8) 、Group_ score(1) 到Group_ score (8)
'是第1小组运动员的姓名和成绩。以此类推存放第2、3组的数据,并且对flag数组
'的各元素赋初值为0。代码略
End Sub
Private Sub Comd1_Click ( )
Dim i As Integer, j As Integer, Left As Integer, Right As Integer
Dim Temp As Single ,Name As String , runway As String
runway = "45362718”
Group_ score(0) = 1000
For i=1 To 3
Call search(i, 8)
Finals_ score(2 * i - 1) = Group_ score (First): Finals_ name (2* i- 1) = Group_ _name (First)
Finals_ score(2 * i) = Group_ score (second1): Finals_ name(2 *i) = Group_ name (second1)
Next i
Call
Finals_ score(7) = Group_ score (First) :Finals_ name(7) =Group_ name (First)
Finals_ score(8) = Group_ score (secondl):Finals_ name(8) =Group_ name (second1)
For i=3 To 8
Left = 1
Right =
Temp = Finals_ score(i) : Name = Finals_ name(i)
Do While Left <= Right
m=(Left+Right)\2
If Finals_ score(i) < Finals_ score(m) Then Right = m- 1
Else Left=m+ 1
Loop
For
Finals_ score(j) = Finals_ score(j- 1) : Finals_ name (j)= Finals_ name(j - 1)
Next j
Finals_ score(Left) = Temp :
Finals_ name(Left) = Name
Next i
For i=1 To 8
List1. AddItem Finals_ name(i) +””+ Str(Finals_ score(i))+””+ Mid(runway, i, 1)
Next i
End Sub
Private Sub search(ByVal a As Integer, ByVal b As Integer)
Dim j As Integer
First=0:second1=0
For j =
If Group_ score(j) < Group_score(First) And flag(j) = 0 Then
second1 = First
First = j
ElseIf Group_ score(j) < Group_ score (secondl) And flag(j) =0 Then
second1 = j
End If
Next j
flag(First) = 1: flag(second1) = 1
End Sub