ASCII码排序——HDU-2000
# 题目
题解
使用while循环实现输入多组数据,然后将三个字符进行排序,输出时在字符中间打上空格即可。
代码实现
//HDU-2000
#include<iostream>
using namespace std;
int main()
{
char a, b, c, temp;
while (cin >> a >> b >> c)
{
if (b < a) { temp = a; a = b; b = temp; }
if (c < b) { temp = b; b = c; c = temp; }
if (b < a) { temp = a; a = b; b = temp; }
cout << a << " " << b << " " << c << endl;
}
}