【VB开源代码栏目提醒】:网学会员,鉴于大家对VB开源代码十分关注,论文会员在此为大家搜集整理了“5.9.frm”一文,供大家参考学习!
VERSION 5.00
Begin VB.Form Form11
Caption = "Form11"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form11"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
End
Attribute VB_Name = "Form11"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
'显示窗体
Show
'定义一维数组学生
Dim student(5) As String * 8
'定义和二维数组学生及分数
Dim score(5, 5) As Single
'数组赋值
student(1) = "王华": student(2) = "李明": student(3) = "孙国"
student(4) = "王凯": student(5) = "平均"
score(1, 1) = 68: score(1, 2) = 84: score(1, 3) = 79
score(2, 1) = 89: score(2, 2) = 92: score(2, 3) = 90
score(3, 1) = 86: score(3, 2) = 69: score(3, 3) = 72
score(4, 1) = 76: score(4, 2) = 62: score(4, 3) = 60
'显示格式
FontSize = 14: FontName = "黑体": FontUnderline = True
Print
Print Tab(14); "学生成绩表"
Print
FontSize = 10: FontName = "宋体": FontUnderline = False
Print ""; Tab(12); "语文"; Tab(20); "数学"; Tab(28); "英语"; _
Tab(36); "总分"; Tab(44); "平均分"
For i = 1 To 4
'计算每个学生的总分和平均分
score(i, 4) = score(i, 1) + score(i, 2) + score(i, 3)
score(i, 5) = score(i, 4) / 3
Next
For i = 1 To 5
'计算各门课程的平均分和总的平均分
score(5, i) = (score(1, i) + score(2, i) + score(3, i) + score(4, i)) / 4
Next i
For i = 1 To 4
'显示每个学生的每门课的分数、总分和平均分
Print student(i);
Print Tab(12); Format(score(i, 1), "###.0");
Print Tab(20); Format(score(i, 2), "###.0");
Print Tab(28); Format(score(i, 3), "###.0");
Print Tab(36); Format(score(i, 4), "###.0");
Print Tab(44); Format(score(i, 5), "###.0")
Next
Print
FontUnderline = True
Print Trim(student(i));
'显示各门课程的平均分和总的平均分
Print Tab(12); Format(score(5, 1), "###.0");
Print Tab(20); Format(score(5, 2), "###.0");
Print Tab(28); Format(score(5, 3), "###.0");
Print Tab(36); Format(score(5, 4), "###.0");
Print Tab(44); Format(score(5, 5), "###.0")
End Sub