有以下程序 void sort(int a[ ],int n) { int i,j,t; for(i=0;i<n-1;i+=2) for(j=i+2;j<n
11 查阅
有以下程序 void sort(int a[ ],int n) { int i,j,t; for(i=0;i<n-1;i+=2) for(j=i+2;j<n;j+=2) if(a[i]<a[j]) { t=a[i];a[i]=a[j];a[j]=t;} } main ( ) { int aa[10]={1,2,3,4,5,6,7,8,9,10},i; sort(aa,10); for(i=0;i<10;i++) printf(“%d”,aa[i]); printf(“\n”);} 其输出结果是( )
A.1,2,3,4,5,6,7,8,9,10,
B.10,9,8,7,6,5,4,3,2,1,
C.9,2,7,4,5,6,3,8,1,10,
D.1,10,3,8,5,6,7,4,9,2,
参考答案: