#include<stdio.h>
void Sort(int *a,int n) {
int *p,*q,*v,t;
for(p = a;p < a + n - 1;++p) {
v = p;
for(q = p + 1; q < a + n; ++q)
if(*v > *q) v = q;
if(*p != *v) {
t = *p;
*p = *v;
*v = t;
}
}
}
void Show(int *a,int n) {
int i;
for(i = 0; i < n; ++i)
printf("%d ",*(a + i));
printf("\n");
}
int main() {
int a[] = {23,12,54,89,66,59,57,48,91,20,31};
int n = sizeof(a)/sizeof(a[0]);
printf("排序前:\n");
Show(a,n);
printf("排序后:\n");
Sort(a,n);
Show(a,n);
return 0;
}