HDU_oj_2000 ASCII码排序

Problem Description
 
输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符。
 
Input
输入数据有多组,每组占一行,有三个字符组成,之间无空格。
 
Output
对于每组输入数据,输出一行,字符中间用一个空格分开。
 
Sample Input
qwe
asd
zxc
 
Sample Output
e q w
a d s
c x z
 
分析:
注意:
 
 1 #include<iostream>
 2 using namespace std;
 3 
 4 int main()
 5 {
 6     char x,y,z;
 7     char temp;
 8     while(cin>>x>>y>>z)
 9     {
10         if(x>y)
11         temp=x,x=y,y=temp;
12         if(y>z)
13         temp=y,y=z,z=temp;
14         if(x>y)
15         temp=x,x=y,y=temp;
16         printf("%c %c %c
",x,y,z);
17     }
18 }
 
原文地址:https://www.cnblogs.com/tenjl-exv/p/7966746.html