wode .frm

来自「筛选和冒泡排序的代码」· FRM 代码 · 共 56 行

FRM
56
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   5820
   ClientLeft      =   120
   ClientTop       =   420
   ClientWidth     =   8775
   LinkTopic       =   "Form1"
   ScaleHeight     =   5820
   ScaleWidth      =   8775
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   1335
      Left            =   1200
      TabIndex        =   0
      Top             =   3360
      Width           =   3495
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub sxl(a() As Integer)
    Dim i As Integer, j As Integer, temp As Integer
    For i = 1 To UBound(a) - 1
        For j = 1 To UBound(a) - i
        If a(j) > a(j + 1) Then
        temp = a(j)
        a(j) = a(j + 1)
        a(j + 1) = temp
        End If
        Next
    Next
    
    
End Sub
Private Sub Command1_Click()
Dim a(10) As Integer, i As Integer

Print "排序前"
For i = 1 To 10
    a(i) = Int(Rnd * (99 - 10 + 1) + 10)

Print a(i);
Next
Print
Print "排序后"
Call sxl(a)
For i = 1 To 10
Print a(i);
Next
End Sub

⌨️ 快捷键说明

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