📄 5-14.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6120
ClientLeft = 60
ClientTop = 405
ClientWidth = 9765
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 6120
ScaleWidth = 9765
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "按成绩排名次"
Height = 615
Left = 4680
TabIndex = 5
Top = 4920
Width = 2175
End
Begin VB.CommandButton Command1
Caption = "输入数据"
Height = 615
Left = 480
TabIndex = 4
Top = 4920
Width = 2175
End
Begin VB.ListBox List2
Height = 3525
ItemData = "5-14.frx":0000
Left = 4560
List = "5-14.frx":0002
TabIndex = 3
Top = 960
Width = 3735
End
Begin VB.ListBox List1
Height = 3525
ItemData = "5-14.frx":0004
Left = 360
List = "5-14.frx":0006
TabIndex = 1
Top = 960
Width = 3735
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "名次:号码:学院:成绩"
Height = 315
Left = 4440
TabIndex = 7
Top = 600
Width = 3015
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "序号:号码:学院:成绩"
Height = 315
Left = 120
TabIndex = 6
Top = 600
Width = 3015
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "成绩排名:"
Height = 315
Left = 4920
TabIndex = 2
Top = 240
Width = 1575
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "成绩列表:"
Height = 315
Left = 600
TabIndex = 0
Top = 240
Width = 1575
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Type game
no As String * 4
colg As String * 4
scor As Single
End Type
Dim a(1 To 8) As game
Private Sub Command1_Click()
Dim i As Integer
List1.Clear
For i = 1 To 8
a(i).no = InputBox("请输入第" & i & "个运动员号码:")
a(i).colg = InputBox("输入" & a(i).no & "号运动员所属学院:")
a(i).scor = InputBox("输入" & a(i).no & "号运动员成绩:")
List1.AddItem Format(i, "@:") & Format(a(i).no, "@@@@@:") & Format(a(i).colg, "@@@@ ") & a(i).scor
Next i
End Sub
Private Sub Command2_Click()
Dim i As Integer, j As Integer, t As game
Dim mc As Integer
List2.Clear
For i = 1 To 7
For j = i + 1 To 8
If a(j).scor < a(i).scor Then
t = a(j): a(j) = a(i): a(i) = t
End If
Next j
Next i
'以下程序可以处理成绩相同时的名次(mc)问题
mc = 1
List2.AddItem Format(mc, "@:") & Format(a(1).no, "@@@@@:") & Format(a(1).colg, "@@@@ ") & a(1).scor
For i = 2 To 8
If a(i).scor <> a(i - 1).scor Then mc = mc + 1
List2.AddItem Format(mc, "@:") & Format(a(i).no, "@@@@@:") & Format(a(i).colg, "@@@@ ") & a(i).scor
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -