ASCII码排序
思路:利用ascll表比较大小
代码:
#include<iostream> using namespace std; int main() { char a, b, c, t; while (cin >> a >> b >> c) { if (a > c) { t = a; a = c; c = t; } if (b > c) { t = b; b = c; c = t; } if (a > b) { t = a; a = b; b = t; } printf("%c %c %c ", a, b, c); } system("pause"); return 0; }