English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

題目
歌唱比賽五位歌者進入總決賽,有十位評審參與評分工作,但每位歌者所獲得的十位評審分數中,要牨去掉最高分與最低分再平均才是歌者的得分,試寫一程式記錄十位評審給五位歌者的分數,最後再計算每位歌者的得分。

我要程式碼。謝謝了!

2005-12-14 09:30:59 · 1 個解答 · 發問者 ★狐狸★ 2 in 電腦與網際網路 程式設計

1 個解答

Private Sub Command1_Click()
Dim S As String, I As Integer, J As Integer, Max As String, Min As String, T As Single
Dim sName(4) As String, N(4, 9) As Integer
For I = 0 To 4
S = InputBox("輸入姓名")
If S = "" Then Exit Sub
sName(I) = S
For J = 0 To 9
JP:
S = InputBox("輸入" & S & "的得分")
If S = "" Then Exit Sub
If IsNumeric(S) = False Then GoTo JP
N(I, J) = Val(S)
Next
Next
For I = 0 To 4
Max = "": Min = "": T = 0
For J = 0 To 9
If Max = "" Then Max = N(I, J): If Min = "" Then Min = N(I, J)
If CInt(Max) < N(I, J) Then Max = N(I, J)
If CInt(Min) > N(I, J) Then Min = N(I, J)
T = T + N(I, J)
Next
Print sName(I) & "的分數 : " & (T - CInt(Max) - CInt(Min)) / 8 & " 分"
Next
End Sub

2005-12-14 12:59:05 · answer #1 · answered by W.J.S. 7 · 0 0

fedest.com, questions and answers