5-14-1.frm

来自「本教材为“第2章”、“第4章”、“第7章”、“第8章”、“第10章”和“第12章」· FRM 代码 · 共 85 行

FRM
85
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "输出结果"
      Height          =   495
      Left            =   2880
      TabIndex        =   2
      Top             =   1680
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "输入数据"
      Height          =   495
      Left            =   2880
      TabIndex        =   1
      Top             =   720
      Width           =   1095
   End
   Begin VB.ListBox List1 
      Columns         =   2
      Height          =   2040
      ItemData        =   "5-14-1.frx":0000
      Left            =   360
      List            =   "5-14-1.frx":0002
      TabIndex        =   0
      Top             =   600
      Width           =   2055
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "序号;号码:学院:成绩"
      Height          =   180
      Left            =   360
      TabIndex        =   3
      Top             =   360
      Width           =   1710
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Type player
no As Integer
college As String * 10
score As Single
End Type
Dim a(1 To 8) As player

Private Sub Command1_Click()
List1.Clear
For i = 1 To 8
With a(i)
.no = InputBox("输入第" & i & "个运动员号")
.score = Val(InputBox("输入第" & i & "个(" & .no & "号)运动员成绩"))
.college = InputBox("输入第" & i & "个(" & .no & "号)运动员所属学院")
List1.AddItem i & ":" & Format(.no, "!@@@@@:") & Format(.college, "@@@@@") & Format(a(i).score, "##.0")
End With
Next i
End Sub

Private Sub Command2_Click()
Dim t As player
List1.Clear
For i = 1 To 7
  For j = i + 1 To 8
   If a(j).score < a(i).score Then
   t = a(i): a(i) = a(j): a(j) = t
   End If
   Next j
List1.AddItem i & ":" & Format(a(i).no, "!@@@@@:") & Format(a(i).college, "@@@@@") & Format(a(i).score, "##.0")
Next i
List1.AddItem i & ":" & Format(a(i).no, "!@@@@@:") & Format(a(i).college, "@@@@@") & Format(a(i).score, "##.0")
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?