跳至内容

算法/Sorting-bubble sort

来自维基教科书,开放世界上的开放教科书

在 visual basic 中

 sub sort_vector(vet() as string, n as integer)
 
 dim c as integer, i as integer
 dim mem as string
 
 for c = 1 to (n - 1)
     for i = c to (n - 1)
         if vet(i) > vet(i + 1)
             mem = vet(i + 1)
             vet(i + 1) = vet(c)
             vet(c) = mem
         end if
     next
 next
 
 end sub
c
华夏公益教科书