📄 5-13-2.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6120
ClientLeft = 60
ClientTop = 405
ClientWidth = 6450
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 = 6450
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "按成绩排名次"
Height = 615
Left = 3600
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-13-2.frx":0000
Left = 3480
List = "5-13-2.frx":0002
TabIndex = 3
Top = 960
Width = 2535
End
Begin VB.ListBox List1
Height = 3525
ItemData = "5-13-2.frx":0004
Left = 360
List = "5-13-2.frx":0006
TabIndex = 1
Top = 960
Width = 2535
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "名次:号码:成绩"
Height = 315
Left = 3360
TabIndex = 7
Top = 600
Width = 2220
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "序号:号码:成绩"
Height = 315
Left = 120
TabIndex = 6
Top = 600
Width = 2220
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "成绩排名:"
Height = 315
Left = 3840
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
Dim a(1 To 8) As String, s(1 To 8) As Single
Private Sub Command1_Click()
Dim i As Integer
List1.Clear
For i = 1 To 8
a(i) = InputBox("请输入第" & i & "个运动员号码:")
s(i) = InputBox("输入" & a(i) & "号运动员成绩")
List1.AddItem Format(i, "@:") & Format(a(i), "@@@@@:") & s(i)
Next i
End Sub
Private Sub Command2_Click()
Dim i As Integer, j As Integer, t1 As String, t2 As Single
Dim mc As Integer
List2.Clear
For i = 1 To 7
For j = i + 1 To 8
If s(j) < s(i) Then
t1 = a(j): a(j) = a(i): a(i) = t1
t2 = s(j): s(j) = s(i): s(i) = t2
End If
Next j
Next i
'以下程序可以处理成绩相同时的名次(mc)问题
mc = 1
List2.AddItem Format(mc, "@:") & Format(a(1), "@@@@@:") & s(1)
For i = 2 To 8
If s(i) <> s(i - 1) Then mc = mc + 1
List2.AddItem Format(mc, "@:") & Format(a(i), "@@@@@:") & s(i)
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -