题目要求:
输入代码:
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
char str[3],temp;
int i,j;
while(gets(str))
{
for(i=0; i<3; i++)
for(j=0; j<3; j++)
if(str[j]>str[j+1])//字符串依旧能够像数字一样排序
{
temp=str[j];
str[j]=str[j+1];
str[j+1]=temp;
}
cout<<str[0]<<" "<<str[1]<<" "<<str[2]<<endl;
}
return 0;
}
执行结果: