编辑代码

#include<stdio.h>
int main(void) {
	char ch[100];
	char t;	//中间变量
	int i = 0, j = 0;

	printf("请输入一个字符串:");
 	scanf("%s",&ch);

	while(ch[i]) {
  		j = i;
  		while(ch[j]) {
   			if((int)*(ch+i) > (int)*(ch+j)) {
    				t = ch[i];
    				ch[i] = ch[j];
    				ch[j] = t;
   			}
   			j++;
  		}
  		i++;
 	}
 	printf("排序后:%s\n",ch);
 	return 0;
}