就是比较数值,把大的或小的放在前面
比如,有一个数组a()包含{5,7,3,9,12,15,56}7个数
dim t as integer
for i=0 to a.count-1
for j=i+1 to a.count-1
t=a(i)
if a(i)<a(j) then
a(i)=a(j)
a(j)=t
next
next
这时比较排序法
下面是冒泡排序
Private Sub Form_Load()
Dim a,c As Variant
Dim i As Integer,j As Integer,temp As Integer,bSwap As Boolean