输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符。
Input输入数据有多组,每组占一行,有三个字符组成,之间无空格。Output对于每组输入数据,输出一行,字符中间用一个空格分开。Sample Input
qwe asd zxcSample Output
e q w a d s c x z
三次比大小,代码实现如下
#include <iostream>
using namespace std;
int main()
{
char a,b,c;
while(cin>>a>>b>>c)
{
if(b>a)
{
char tem;
tem=a;
a=b;
b=tem;
}
if(c>a)
{
char tam;
tam=a;
a=c;
c=tam;
}
if(c>b)
{
char tnm;
tnm=b;
b=c;
c=tnm;
}
cout<<c<<" "<<b<<" "<<a<<endl;
}
}
3146

被折叠的 条评论
为什么被折叠?



