求一个VB程序

来源:百度知道 编辑:UC知道 时间:2024/06/23 14:11:03
打印n个同学的m门课程的考试成绩,并计算出每个同学的平均分
希望大家帮我解决一下 谢谢。。。

没分我还给你回答,你当我傻啊!

Dim Students(8) As String
Dim Course(4) As Integer
Private Sub Command1_Click()
For j = LBound(Students) To UBound(Students)
For k = LBound(Course) To UBound(Course)
NC = NC & " " & Course(k)
NT = NT + Course(k)
Next
Me.Print Students(j) & NC & " " & NT / (k - 1)
NC = ""
NT = 0
Next

End Sub

Private Sub Form_Load()
Students(0) = "A1"
Students(1) = "A2"
Students(2) = "A3"
Students(3) = "A4"
Students(4) = "A5"
Students(5) = "A6"
Students(6) = "A7"
Students(7) = "A8"
Students(8) = "A9"

Course(0) = "50"
Course(1) = "60"
Course(2) = "70"
Course(3