这是一个用Vb设计的五个评委打分去掉一个最高分和一个最低分求平均值的属性窗口,请问该怎么写它的代码
2个回答
展开全部
Dim Score(4) As Single
Private Sub Command1_Click()
For i = 0 To 4
Score(i) = Val(Text1(i).Text)
Next i
For i = 0 To 3
For j = i + 1 To 4
If Score(j) > Score(i) Then
t = Score(i)
Score(i) = Score(j)
Score(j) = t
End If
Next j
Next i
Text1(5).Text = Score(0)
Text1(6).Text = Score(4)
Command2.Enabled = True
End Sub
Private Sub Command2_Click()
For i = 1 To 3
Sum = Sum + Score(i)
Next i
Text1(7) = Format(Sum / 3, "0.00")
End Sub
Private Sub Form_Load()
Command2.Enabled = False
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询