'n和m是常量,分别表示节目数和评委数,代码略
Dim df(1 To m * n) As Integer
Private Sub Form Load()
'从数据库中读取n个节目的m个评委的评分、依次存入数组df中,并显示在List1中,代码略。
End Sub
Private Sub Command1_ Click ()
Dim i As Integer, j As Integer, cnt As Integer
Dim sum As Integer, max As Integer, min As Integer
Dim index(1 To n) As Integer, score(1 To n) As Single
For i=1 To n
x=(i-1)*m+1
y=i*m
sum=0:cnt=0
For j=x To y
If df(j)=0 Then cnt=cnt+1
sum =
Next j
max = df(x): min = df(x) '统计每个节目的最高分与最低分
For j=x+1 To y
If df(j) > max Then max = df(j)
If df(j)<>0And()Then min=df(j)
Next j
If cnt<m-2 Then score(i)=
index(i) = i
Next i
For i=1 To n
For j=nToi+1Step -1
If Then
t = index(j): index(j) = index(j- 1): index(j- 1) = t
End If
Next j
Next i
For i=1 To n
List2.AddItem"节目" & index(i) & "得分:" & Int (score (index(i))*100)/100
Next i
End Sub