问题链接:https://vjudge.net/problem/hdu-2000
程序说明:用while语句实现输入多组数据,用for循环和if语句实现字符的ASCII码从小到大排序。
Get:char定义的单个字符可以直接大小比较,例如: if(a[j]>a[j+1])
AC代码:
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
char a[3];
while (cin >>a)
{
sort(a, a + 3);
cout << a[0] << " " << a[1] << " " << a[2] << endl;
}
return 0;
}