vb编程:输入学生的姓名,学号和成绩。成绩包括高数、英语和专业课,判断该生能获几等奖并输出。 5
1个回答
展开全部
代码如下。
======================
Private Sub Command1_Click()
Dim name As String, num As Integer, s1 As Single, s2 As Single, s3 As Single, s As String
name = InputBox("输入学生的姓名")
num = Val(InputBox("输入学生的学号"))
s1 = Val(InputBox("输入高数成绩"))
s2 = Val(InputBox("输入英语成绩"))
s3 = Val(InputBox("输入专业课成绩"))
If s1 > 95 And s2 > 95 And s3 > 95 Then
s = "一等"
Else
If s1 > 90 And s2 > 90 And s3 > 90 Then
s = "二等"
Else
If s1 > 88 And s2 > 88 And s3 > 88 Then
s = "三等"
Else
s = "无奖"
End If
End If
End If
MsgBox "学生" + name + "(学号" + Str(num) + ")的成绩是" + vbCrLf + s
End Sub
======================
Private Sub Command1_Click()
Dim name As String, num As Integer, s1 As Single, s2 As Single, s3 As Single, s As String
name = InputBox("输入学生的姓名")
num = Val(InputBox("输入学生的学号"))
s1 = Val(InputBox("输入高数成绩"))
s2 = Val(InputBox("输入英语成绩"))
s3 = Val(InputBox("输入专业课成绩"))
If s1 > 95 And s2 > 95 And s3 > 95 Then
s = "一等"
Else
If s1 > 90 And s2 > 90 And s3 > 90 Then
s = "二等"
Else
If s1 > 88 And s2 > 88 And s3 > 88 Then
s = "三等"
Else
s = "无奖"
End If
End If
End If
MsgBox "学生" + name + "(学号" + Str(num) + ")的成绩是" + vbCrLf + s
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询