📄 例2-30.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton CmdCalcu
Caption = "统计"
Height = 615
Left = 1200
TabIndex = 7
Top = 2520
Width = 1935
End
Begin VB.Label Label7
Caption = "英语平均分:"
Height = 495
Left = 240
TabIndex = 6
Top = 1320
Width = 2295
End
Begin VB.Label Label6
Caption = "数学平均分:"
Height = 375
Left = 2640
TabIndex = 5
Top = 1320
Width = 2055
End
Begin VB.Label Label5
Caption = "计算机平均分:"
Height = 375
Left = 240
TabIndex = 4
Top = 1920
Width = 2415
End
Begin VB.Label Label4
Caption = "张艳平均分:"
Height = 375
Left = 2640
TabIndex = 3
Top = 720
Width = 1935
End
Begin VB.Label Label3
Caption = "赵明平均分:"
Height = 375
Left = 2640
TabIndex = 2
Top = 240
Width = 2055
End
Begin VB.Label Label2
Caption = "王刚平均分:"
Height = 375
Left = 240
TabIndex = 1
Top = 720
Width = 2175
End
Begin VB.Label Label1
Caption = "李利平均分:"
Height = 375
Left = 240
TabIndex = 0
Top = 240
Width = 2055
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim A(3, 2), B(3), C(2)
Private Sub CmdCalcu_Click()
Dim i, j As Integer
Dim Total As Single
For i = 0 To 3
Total = 0
For j = 0 To 2
Total = Total + A(i, j)
Next j
B(i) = Total / 3
Next i
For j = 0 To 2
For i = 0 To 3
C(j) = C(j) + A(i, j)
Next i
C(j) = C(j) / 4
Next j
Label1.Caption = Label1.Caption + Format(B(0), "00.00")
Label2.Caption = Label2.Caption + Format(B(1), "00.00")
Label3.Caption = Label3.Caption + Format(B(2), "00.00")
Label4.Caption = Label4.Caption + Format(B(3), "00.00")
Label5.Caption = Label5.Caption + Format(C(0), "00.00")
Label6.Caption = Label6.Caption + Format(C(1), "00.00")
Label7.Caption = Label7.Caption + Format(C(2), "00.00")
End Sub
Private Sub Form_Load()
A(0, 0) = 87
A(0, 1) = 82
A(0, 2) = 97
A(1, 0) = 83.5
A(1, 1) = 74
A(1, 2) = 67
A(2, 0) = 89
A(2, 1) = 51
A(2, 2) = 88
A(3, 0) = 59
A(3, 1) = 83
A(3, 2) = 92.5
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -