请教大神,这段语句哪里错了
我是文本导入的,求出最大值,最小值和平均值,最大值和平均值是对的,可是最小值是错的程序代码:
是对的,可是最小值是错的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