#include #include #include #include using namespace std; void print_letters(); int main(int argc, char **argv) { unsigned line = 0; unsigned comment = 0; char c; while (cin.get(c)) { cout << setw(2) << ++line << " "; assert(c == '\0'); cin.get(c); if (c == '\0') { //comment cin.get(c); assert(c == '\020'); cin.get(c); assert(c == '\0'); cin.get(c); assert(c == '\0'); cin.get(c); ++comment; assert(c == comment); cout << "' "; //comment delimiter do { cin.get(c); cout << c; } while (c != '\n'); } else if (c == '\024') { cout << "Fade "; cin.get(c); cout << static_cast(c) << " "; print_letters(); } else if (c == '\030') { cout << "Alt "; cin.get(c); cout << static_cast(c) << " "; print_letters(); } else { cerr << argv[0] << ": byte == " << static_cast( static_cast(c)) << "\n"; return EXIT_FAILURE; } } return EXIT_SUCCESS; } void print_letters() { cout << " "; char letter = 'A'; unsigned char uc = cin.get(); unsigned bits = 65536 * uc; //Q-V uc = cin.get(); bits += 256 * uc; //I-P uc = cin.get(); bits += uc; //A-H for (unsigned mask = 1; letter <= 'V'; mask <<= 1) { cout << (bits & mask ? letter : ' '); ++letter; } cout << "\n"; }