#include // This program reads a string of characters // terminated by a period and encode the characters as // follows: // A -> Z // B -> A // C -> B // ... // Z -> Y int main() { char c; cout << "Enter a line of text terminated by 'enter': "; for (cin >> c; c != '.'; cin >> c) { if (c == 'A') c = 'Z'; else if (c == 'a') c = 'z'; else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) --c; cout << c; } cout << endl; }