成绩统计和查询的vb编程

来源:百度知道 编辑:UC知道 时间:2024/05/29 08:13:25

Open "C:\score2007.txt" For Input As #1
Dim linetxt As String
Dim c90, c80, c70, c60, c0 As Integer

Do While Not EOF(1)
Line Input #1, linetxt
If Len(Trim(linetxt)) > 0 Then
tmpArr = Split(linetxt, " ")
Select Case CDbl(tmpArr(1))
Case Is >= 90
c90 = c90 + 1
Case Is >= 80
c80 = c80 + 1
Case Is >= 70
c70 = c70 + 1
Case Is >= 60
c60 = c60 + 1
Case Else
c0 = c0 + 1
End Select
End If
Loop
Close #1

Open "c:\renshu.txt" For Output As #2

Print #2, "100-90 共:" + CStr(c90) + " 人"
Print #2, "---------------------------------------------------"
Print #2, "89-80 共:" + CStr(c80) + " 人"
Print #2, "---------------------------------------------------"
Print #2, "79-70 共:" + CStr(c70) + " 人"