关于一个竞赛的程序
题目,8位评委给10位选手评分,去掉一个最高分和最低分,算出平均分,然后根据平均分输出10位选手的排名。(用一个一维数组存放八个分数 然后用一个二维数组记录 )下面是部分代码,请大虾帮忙完整一下。。。Option Base 0
Dim s(5, 10) As Single
Dim str1 As String
Private Sub Command1_Click() '输入选手成绩
i = Val(InputBox("请输入选手号码(1-10)"))
If i < 1 Or i > 5 Then Exit Sub
For j = 1 To 8
s(i, j) = Val(InputBox("请输入 " & j & "号裁判的打分(10分)"))
If s(i, j) > 10 Or s(i, j) < 0 Then j = j - 1
Next j
smin = 0
smax = 10
ss = 0
str2 = s(i, 0) & Chr(9)
For j = 1 To 6
str2 = str2 & CStr(s(i, j)) & Chr(9)
ss = ss + s(i, j)
If s(i, j) > smax Then smax = s(i, j)
If s(i, j) < smin Then smin = s(i, j)
Next j
s(i, 7) = smin
s(i, 8) = smax
s(i, 9) = (ss - smin - smax) / 4
Print str1
Print str2 & s(i, 7) & Chr(9) & s(i, 8) & Chr(9) & s(i, 9)
End Sub
Private Sub Form_Load()
str1 = "选手号码" & Chr(9)
For i = 1 To 6
str1 = str1 & "裁判" & i & Chr(9)
Next i
str1 = str1 & "最低分" & Chr(9) & "最高分" & Chr(9) & "平均分" & Chr(9) & "排名"
End Sub