c++实现
void to_sort(int arr[], int num) {
int temp;
for (int i = 0; i < num; i++) {
int max = i;
for (int j = i + 1; j < num; j++) {
if (arr[max] > arr[j]) {
max = j;
}
}
if (max != i) {
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}