📄 分类统计.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "例[7-9] 分类统计"
ClientHeight = 2715
ClientLeft = 45
ClientTop = 330
ClientWidth = 3975
LinkTopic = "Form1"
ScaleHeight = 2715
ScaleWidth = 3975
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "统计各分数段人数"
Height = 2412
Left = 120
TabIndex = 0
Top = 120
Width = 3612
Begin VB.ListBox List1
Height = 1320
ItemData = "分类统计.frx":0000
Left = 120
List = "分类统计.frx":0002
TabIndex = 3
Top = 720
Width = 3372
End
Begin VB.CommandButton Command1
Caption = "输入数据"
Height = 372
Left = 120
TabIndex = 1
Top = 240
Width = 1212
End
Begin VB.Label Label1
Height = 372
Left = 1800
TabIndex = 2
Top = 240
Width = 1572
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a(10) As Integer
Private Sub Command1_Click()
Dim i As Integer, p As Integer, n As Integer
Dim x As Single
n = InputBox("n=", "请输入学生数")
Label1.Caption = "共有人数:" & n
For i = 1 To n
x = Val(InputBox("请输入第" & Str(i) & "名学生的成绩:", ""))
If x >= 0 And x <= 100 Then
p = Int(x / 10)
a(p) = a(p) + 1
Else
MsgBox "请输入正确分数!"
i = i - 1
End If
Next i
For p = 0 To 9
List1.AddItem (p * 10 & "~" & (p * 10 + 9) & "分的人数为:" & a(p))
Next p
List1.AddItem ("100分的人数为:" & a(10))
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -