modbubble.bas
来自「Visual Basic 6 大学教程的代码」· BAS 代码 · 共 24 行
BAS
24 行
Attribute VB_Name = "modBubble"
' Module modBubble.bas
Option Explicit
Public Sub BubbleSort(theArray() As Integer)
Dim pass As Integer, compare As Integer
Dim hold As Integer
For pass = 1 To (UBound(theArray) - 1)
For compare = 1 To (UBound(theArray) - 1)
If theArray(compare) > theArray(compare + 1) Then
hold = theArray(compare)
theArray(compare) = theArray(compare + 1)
theArray(compare + 1) = hold
End If
Next compare
Next pass
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?