vb编程十位评委给歌手打分,要求去掉一个最高分一个最低分。然后再求出选手的平均分

2025-03-19 22:12:54
推荐回答(2个)
回答1:

Dim arr(1 To 10) As Double
Const N = 10
Private Sub Command1_Click()
Record
Dim temp As Double
For i = 1 To N - 1
For j = 1 To N - 1
If arr(j) > arr(j + 1) Then
t = arr(j): arr(j) = arr(j + 1): arr(j + 1) = t
End If
Next j
Next i
showr
End Sub
Private Sub Form_Load()
For txtcount = 0 To 9
Text1(txtcount).Text = ""
Next

End Sub
Private Sub Record()
For txtcount = 0 To 9
arr(txtcount + 1) = Val(Text1(txtcount).Text)
Next
End Sub
Private Sub sort()

End Sub
Private Sub showr()
For txtcount = 0 To 9
Text1(txtcount).Text = arr(txtcount + 1)
Next
End Sub

还要加入10个输入框数组控件,亲测可行,望采纳~

回答2:

我有个6位评委打分的。需要的话,给我留个邮箱