在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
package main import ( "fmt" ) func main() { a := [...]int{12, 32, 434, 765, 34, 8, 94, 12, 34, 53} num := len(a) fmt.Println(a) for i := 0; i < num; i++ { for j := i + 1; j < num; j++ { if a[i] < a[j] { temp := a[i] a[i] = a[j] a[j] = temp } } } fmt.Println(a) } [ `go run test1.go` | done: 195.80006ms ] |
请发表评论