![]() |
#2
风吹过b2015-06-19 08:26
|

是对的,可是最小值是错的Private Sub Command2_Click()
Dim score As String
Dim count As Integer
Dim ave As Single
Dim max As Single
Dim min As Single
Dim d As Single
max = 0
min = 1000
count = 0
sum = 0
Open App.Path + "\123.txt" For Input As #1
Do While Not EOF(1)
Input #1, id, na, sex, math, computer, english, chinese
If id <> "" Then
count = count + 1
d = math + computer + english + chinese
sum = sum + d
If d > max Then
max = d
If d < min Then
min = d
End If
End If
End If
Loop
Close #1
ave = sum / count
Text2.Text = ave
Text3.Text = max
Text4.Text = min
End Sub
Dim score As String
Dim count As Integer
Dim ave As Single
Dim max As Single
Dim min As Single
Dim d As Single
max = 0
min = 1000
count = 0
sum = 0
Open App.Path + "\123.txt" For Input As #1
Do While Not EOF(1)
Input #1, id, na, sex, math, computer, english, chinese
If id <> "" Then
count = count + 1
d = math + computer + english + chinese
sum = sum + d
If d > max Then
max = d
If d < min Then
min = d
End If
End If
End If
Loop
Close #1
ave = sum / count
Text2.Text = ave
Text3.Text = max
Text4.Text = min
End Sub