VB输入语文、数学、英语的成绩,分别计算等第,总分和平均分.

问题描述:

VB输入语文、数学、英语的成绩,分别计算等第,总分和平均分.
85以上是优,85~75良,74~60及格,60以下不及格
要用8个textbox,8个按钮
只学了顺序结构,if语句

Private Sub Command1_Click()
Dim Level(1 To 3) As Integer
Dim FScore(1 To 3) As Long
Dim STName(1 To 3) As String
Dim i As Integer,Total As Long,PJF As Long
FScore(1) = Text(1) '前三个填成绩
FScore(2) = Text(2)
FScore(3) = Text(3)
STName(1) = "数学"
STName(2) = "语文"
STName(3) = "英语"
'计算等级
For i = 1 To 3
If FScore(i) > 85 Then Level(i) = 1
If FScore(i) = 75 Then Level(i) = 2
If FScore(i) = 60 Then Level(i) = 3
If FScore(i) Next i
For i = 1 To 3
Select Case Level(i)
Case 1
Text(i+3) = STName(i) & ":优"
Case 2
Text(i+3) = STName(i) & ":良"
Case 3
Text(i+3) = STName(i) & ":及格"
Case 4
Text(i+3) = STName(i) & ":不及格"
End Select
'计算总分
Total = FScore(1) + FScore(2) + FScore(3)
Text(7) = Total
'计算平均分
PJF = (Total) / 3
Text(8) = PJF
End Sub