📄 modbubble.bas
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -