选择排序通用
#include <iostream>
using namespace std;
int main() {
//选择排序通用
int a[] = { 8,9,1,4,2,3,6,7,5 };
for (int j = 0; j < 9; j++) {
cout << a[j] << " ";
}
cout << endl;
for(int ii=0;ii<9;ii++){
for (int i = ii; i < 9; i++) {
if (a[ii] >= a[i]) {
swap(a[ii], a[i]);
}
}
cout << a[ii];
cout << endl;
}
for (int k = 0; k < 9; k++) {
cout << a[k] << " ";
}
getchar();
return 0;
}