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

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

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