字符串内排序(九度教程第5题)

在这里插入图片描述

#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdio.h>
using namespace std;
int main()
{
    
    
    char a[101];
    while(gets(a))
    {
    
    
        int len=strlen(a);
        if(len==0)
            break;
        sort(a,a+len);
        puts(a);
    }
    return 0;
}

C 库函数 int puts(const char *str) 把一个字符串写入到标准输出 stdout,直到空字符,但不包括空字符。换行符会被追加到输出中。

猜你喜欢

转载自blog.csdn.net/weixin_44022810/article/details/106822680