visual basic程序设计教程第四版答案(刘炳文)
从键盘上输入一个学生的学号和考试成绩,然后输出该学生的学号和考试成绩,并根据成绩按下面的规定输出对该学生的评语:
成绩 80~100 60~79 50~59 40~49 0~39
评语 very good good fair poor fail
以下是此题的【VB源代码】
Private Sub Form_Click()
n = InputBox("请输入学号")
s = InputBox("请输入分数")
If s >= 80 Then
Print "学号:"; n; ","; "分数:"; s; ","; "学生评语:"; "Very Good"
ElseIf s >= 60 And s <= 79 Then
Print "学号:"; n; ","; "分数:"; s; ","; "学生评语:"; "Good"
ElseIf s >= 50 And s <= 59 Then
Print "学号:"; n; ","; "分数:"; s; ","; "学生评语:"; "Fair"
ElseIf s >= 40 And s <= 49 Then
Print "学号:"; n; ","; "分数:"; s; ","; "学生评语:"; "Poor"
ElseIf s >= 0 And s <= 39 Then
Print "学号:"; n; ","; "分数:"; s; ","; "学生评语:"; "Fail"
End If
End Sub
********************************
新世纪计算机基础教育丛书 丛书主编:谭浩强
Visual Basic 程序设计教程 题解与上机指导(第四版) 刘炳文 编著
来源:visual basic程序设计教程第四版答案(刘炳文)
本文链接:http://www.wb98.com/vb1/post/vb_7.10.html
本站文章搜索: