题解 | #图片整理#

图片整理

https://www.nowcoder.com/practice/2de4127fda5e46858aa85d254af43941

#include <stdio.h>
#include <string.h>

int main() {

    char str[1000];
    fgets(str, 1002, stdin);//注意fgets函数的内存需要  内容+2
    int len = strlen(str);
    char temp;

    for (int i = 0; i < len-2 ; i++) {
        for (int j = i+1; j < len-1; j++) {
            if (str[i] > str[j] ) {
                temp = str[j];
                str[j] = str[i];
                str[i] = temp;           
            }
        
        }
    
    }


        printf("%s", str);
    return 0;
}                                                                                 

全部评论

相关推荐

09-23 14:45
贵州大学 财务
勇敢求职牛牛:怎么9.2佬人手一个中信证券实习
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务