📄 排序.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "例[7-12] 用选择法排序"
ClientHeight = 1815
ClientLeft = 45
ClientTop = 330
ClientWidth = 3735
LinkTopic = "Form1"
ScaleHeight = 1815
ScaleWidth = 3735
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "演示"
Height = 372
Left = 1440
TabIndex = 4
Top = 1320
Width = 972
End
Begin VB.Label Label4
BorderStyle = 1 'Fixed Single
Height = 372
Left = 1200
TabIndex = 3
Top = 720
Width = 2172
End
Begin VB.Label Label3
Caption = "排序后:"
Height = 372
Left = 360
TabIndex = 2
Top = 720
Width = 972
End
Begin VB.Label Label2
BorderStyle = 1 'Fixed Single
Height = 372
Left = 1200
TabIndex = 1
Top = 120
Width = 2172
End
Begin VB.Label Label1
Caption = "排序前:"
Height = 372
Left = 360
TabIndex = 0
Top = 240
Width = 972
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(6) As Integer
Dim k%, n%, i%, j%, t%
Randomize
n = 6
For i = 1 To n
a(i) = Int(Rnd * 9) + 1
Label2 = Label2 + Str(a(i))
Next i
For i = 1 To n - 1
For j = n To i + 1 Step -1
If a(j - 1) > a(j) Then t = a(j): a(j) = a(j - 1): a(j - 1) = t
Next j
Label4 = Label4 + Str(a(i))
Next i
Label4 = Label4 + Str(a(i))
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -