最终得分=(所有评委打分总和-1个最高分-1个最低分)×项目难度系数
编写VB程序,实现计算最终得分的功能。在文本框Text1中输入项目难度系数和多位评委的打分,中间用“,”隔开并以“,”结尾,然后点击计算按钮,在文本框Text2中显示最终得分。程序运行界面如图所示。
Private Sub Cmd1_Click()
Dim a(1 To 100) As Single
Dim i As Integer, j As Integer, k As Integer, m As Integer, n As Integer
Dim Tot As Single, tmp As Single
Dim s As String, v As String, ch As String
s = Text1.Text
n = 1:v=""
Do While n <= Len(s)
ch = Mid(s, n, 1)
If ch <> "," Then
v = v & ch
Else
a(m) = Val(v)
m = m + 1
End If
n = n + 1
Loop
For i = 2 To m - 2
For j = m - 1 To i + 1 Step -1
If a(i) < a(j) Then
tmp = a(i): a(i) = a(j): a(j) = tmp
End If
Next j
Next i
Tot = 0
For
Tot = Tot + a(i)
Next i
Text2.Text =
End Sub