#include<stdio.h>
void select(int *num,int len){
int i,j,temp;
for(i = 0;i < len;i++){
for(j = i+1;j < len;j++){
if(num > num[j]){
temp = num[j];
num[j] = num;
num = temp;
}
}
}
for(i = 0;i < len;i++){
printf("%d ",num);
}
printf("\n");
}
int main(){
int num[10] = {10,5,21,4,85,91,42,0,124,31};
int i = 0;
for(i = 0;i < 10;i++){
printf("%d ",num);
}
printf("\n");
select(num,10);
return 0;
}
|
|
|