VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "矩阵排序例"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   735
      Left            =   1920
      TabIndex        =   0
      Top             =   2520
      Width           =   1695
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 1
Private Sub Command1_Click()
  Dim a%(1 To 10), i%, k%
  For i = 1 To 9                        ' 通过程序自动形成有规律的数组
     a(i) = (i - 1) * 3 + 1
     Print a(i);
  Next i
  For k = 1 To 9                        ' 查找欲插入数14在数组中的位置
    If 14 < a(k) Then Exit For          ' 找到插入的位置下标为k
  Next k
  For i = 9 To k Step -1                    ' 从最后元素开始往后移，腾出位置
    a(i + 1) = a(i)
  Next i
  a(k) = 14                         ' 数插入
  Print
  For i = 1 To 10
    If a(i) = 14 Then Form1.FontBold = True Else Form1.FontBold = False
    Print a(i);
    
  Next i
End Sub

