practice7_1.frm
来自「深圳大学的vb上机与教学的课件」· FRM 代码 · 共 91 行
FRM
91 行
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2445
ClientLeft = 60
ClientTop = 345
ClientWidth = 4515
LinkTopic = "Form1"
ScaleHeight = 2445
ScaleWidth = 4515
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2040
Locked = -1 'True
TabIndex = 2
Top = 600
Width = 1935
End
Begin VB.CommandButton Command1
Caption = "输入成绩计算"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1440
TabIndex = 0
Top = 1440
Width = 2175
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "成绩标准差:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Left = 240
TabIndex = 1
Top = 720
Width = 1710
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 1
Dim score() As Integer
Private Sub Command1_Click()
n = Val(InputBox("请输入总人数", "", ""))
ReDim score(n)
S = 0
Sum = 0
For i = 1 To n
score(i) = Val(InputBox("请输入第" & Str(i) & "个学生的成绩", "成绩统计", ""))
S = S + score(i)
Next i
Avg = S / n
For i = 1 To n
Item = ((score(i) - Avg) ^ 2)
Sum = Sum + Item
Next i
y = Sqr(Sum / (n - 1))
Text1.Text = Format(y, "0.0000")
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?