//SelectSort 选择排序 func SelectSort(arr *[7]int) { for i := 0; i < len(arr); i++ { tmp := arr[i] index := i for j := i + 1; j < len(arr); j++ { if (*arr)[j] < tmp { tmp = (*arr)[j] index = j } } if index != i { (*arr)[index],(*arr)[i] = (*arr)[i],(*arr)[index] } fmt.Printf("第%d次选择后的结果是:%v",i,*arr) } }