package main
import (
"fmt"
)
/* 冒泡排序函数*/
func bubbleSort(arr []int) []int {
length := len(arr)
for i := 0; i < length; i++ {
for j := 0; j < length-1-i; j++ {
if arr[j] > arr[j+1] {
arr[j], arr[j+1] = arr[j+1], arr[j]
}
}
}
return arr
}
/*主程序*/
func main() {
var j int
var n []int /* n 是一个数组 */
var s = []int{23,45,33,55,67,89,87,55,33,24,56,23}
n = bubbleSort(s)
for j = 0; j < len(n); j++ {
fmt.Printf("array_Sort[%d] = %d\n", j, n[j] )
}
}