ASCII码排序
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main() { char c, a[3]; int i = 0; while(~scanf("%c", &c)) { a[i] = c; if(i == 3) { sort(a, a + 3); for(int j = 0; j < 3; ++ j) { if(j == 2) printf("%c\n", a[j]); else printf("%c ", a[j]); } i = 0; } else { i ++; } } return 0; }