切片整型升序排序
package main
import "fmt"
func main() {
slic := []int{10, 100, 20, 15, 1, 1000, 50, 20}
sic := sortIntAsc(slic)
fmt.Println(sic)
}
func sortIntAsc(num []int) []int {
for i := 0; i < len(num); i++ {
for j := i + 1; j < len(num); j++ {
if num[i] < num[j] {
temp := num[i]
num[i] = num[j]
num[j] = temp
}
}
}
return num
}