Department of Computer Science | Institute of Theoretical Computer Science | CADMO

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

// Program: caesar_decrypt.cpp // decrypts a text by applying a cyclic shift of minus one #include #include // for std::noskipws int main () { std::cin >> std::noskipws; // don't skip whitespaces! // decryption loop char next; while (std::cin >> next) { // shift the 95 printable characters only, assuming ASCII if (next > 31 && next < 127) { if (next > 32) --next; else next = 126; } std::cout << next; } return 0; }