#define N 26
#include
void fun(char str[]);
int main(){
int i,j;
char str[N];
for (i=0;iscanf("%c",&str[i]);
fun(str);
for (i=0;iprintf("%c ",str[i]);
}
void fun(char str[]){
char min;
int i,j,mark;
for(i=0;imin=str[i];
mark=i;
for(j=i;jif (min>str[j]){
min = str[j];
mark=j;
}
min=str[i];
str[i]=str[mark];
str[mark]=min;
}
}
那个函数就是fun()函数。。。
void Sort(char a[], int N) {
int i, j;
char tem;
for(i = 0; i < N - 1; ++i) {
for(j = i + 1; i < N; ++j) {
if(a[i] > a[j]) {
tem = a[i];
a[i] = a[j];
a[j] = tem;
}
}
}
}