用VB编写一学生成绩统计程序
用户先输入学生的人数及科目数,再输入各位学生的各科目课程的考试成绩,要求该程序可以计算各个学生的平均成绩及每门课程的平均成绩...
用户先输入学生的人数及科目数,再输入各位学生的各科目课程的考试成绩,要求该程序可以计算各个学生的平均成绩及每门课程的平均成绩
展开
3个回答
推荐于2017-11-29
展开全部
Private Sub Form_Click()
Dim Score As Single, Sum As Single, N As Integer, Average As Single
Sum = 0
N = 0
Score = InputBox("请输入第" & N + 1 & "个同学的成绩", "成绩输入")
Do While Score <> -1
Sum = Sum + Score
N = N + 1
Score = InputBox("请输入第" & N + 1 & "个同学的成绩", "成绩输入")
Loop
Average = Sum / N
Print "平均成绩为:"; Average
End Sub
Dim Score As Single, Sum As Single, N As Integer, Average As Single
Sum = 0
N = 0
Score = InputBox("请输入第" & N + 1 & "个同学的成绩", "成绩输入")
Do While Score <> -1
Sum = Sum + Score
N = N + 1
Score = InputBox("请输入第" & N + 1 & "个同学的成绩", "成绩输入")
Loop
Average = Sum / N
Print "平均成绩为:"; Average
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询