📄 form0605.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "计算平均成绩"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4245
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4245
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "计算"
Height = 495
Left = 1560
TabIndex = 4
Top = 2400
Width = 1335
End
Begin VB.TextBox Text2
Height = 495
Left = 2160
TabIndex = 3
Top = 1440
Width = 1455
End
Begin VB.TextBox Text1
Height = 495
Left = 2160
TabIndex = 0
Top = 480
Width = 1455
End
Begin VB.Label Label2
Caption = "数学平均成绩"
Height = 375
Left = 480
TabIndex = 2
Top = 1560
Width = 1455
End
Begin VB.Label Label1
Caption = "语文平均成绩"
Height = 375
Left = 480
TabIndex = 1
Top = 480
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Private Sub Command1_Click()
'单击计算按钮
Dim Score1(4) As Single, Score2(4) As Single
Dim i As Integer, j As Integer
'输入分数
Score1(1) = 98: Score2(1) = 84
Score1(2) = 82: Score2(2) = 86
Score1(3) = 76: Score2(3) = 79
Score1(4) = 66: Score2(4) = 72
Text1.Text = Int(Average(Score1) * 100) / 100
Text2.Text = Int(Average(Score2) * 100) / 100
End Sub
Private Function Average(s() As Single) As Single
' 求平均成绩子函数
Dim i As Integer
Dim Aver As Single, Sum As Single
For i = 1 To 4
Sum = Sum + s(i)
Next
Aver = Sum / 4
Average = Aver
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -