解题思路:用冒泡排序法进行排序
注意事项:见代码
参考代码:
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
while(getline(cin,s))//有多组输入数据
{
//冒泡排序
for(int i=0;i<s.length();i++)
{
for(int j=0;j<s.length()-i-1;j++)
{
if(s[j]>s[j+1])
swap(s[j],s[j+1]);
}
}
for(int i=0;i<s.length();i++)
{
cout<<s[i];
}
cout<<endl;
}
return 0;
}
0.0分
0 人评分