VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2355
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7155
   LinkTopic       =   "Form1"
   ScaleHeight     =   2355
   ScaleWidth      =   7155
   StartUpPosition =   3  '窗口缺省
   Begin VB.PictureBox Picture1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2055
      Left            =   3840
      ScaleHeight     =   1995
      ScaleWidth      =   2955
      TabIndex        =   6
      Top             =   240
      Width           =   3015
   End
   Begin VB.CommandButton Command2 
      Caption         =   "排序"
      Height          =   495
      Left            =   2160
      TabIndex        =   5
      Top             =   1680
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加"
      Height          =   495
      Left            =   840
      TabIndex        =   4
      Top             =   1680
      Width           =   1095
   End
   Begin VB.TextBox Text3 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   2640
      TabIndex        =   3
      Top             =   840
      Width           =   975
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   1440
      TabIndex        =   2
      Top             =   840
      Width           =   975
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   240
      TabIndex        =   1
      Top             =   840
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "职工号      姓名      工资"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   360
      TabIndex        =   0
      Top             =   360
      Width           =   3615
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a() As zg, i%

Private Sub Command1_Click()
   i = i + 1
   If i < n Then MsgBox ("人数超过"): Exit Sub
   With a(i)
    .gh = Val(Text1)
    .xm = Text2
    .gz = Val(Text3)
  End With
  Text1 = "":   Text2 = "": Text3 = ""
 
End Sub

Private Sub Command2_Click()
  Dim j%, k%, t As zg
  For j = 1 To i - 1
    For k = j + 1 To i
      If a(k).gz > a(k - 1).gz Then
         t = a(k)
         a(k) = a(k - 1)
         a(k - 1) = t
      End If
    Next k
  Next j
  For j = 1 To i
    Picture1.Print a(j).gh; a(j).xm; a(j).gz
  Next j
End Sub

Private Sub Form_Load()
  Dim n%
  n = InputBox("输入人数")
  ReDim a(1 To n)
  i = 0
End Sub
