c语言冒泡实现将一个字符串按照字典顺序输出

来源:互联网 发布:配音配词软件 编辑:程序博客网 时间:2024/05/29 19:55
#include<stdio.h>#include<string.h>void main(){    char a[100];    gets(a);    int i,j,temp;    for(j=0;j<strlen(a);j++){        for (i = 0; i < strlen(a) - 1 - j; i++)        {            if(a[i] < a[i + 1])            {                temp = a[i];                a[i] = a[i + 1];                a[i + 1] = temp;            }        }      printf("%c",a[i]);    }}
0 1