The program output is also shown below. #include #include using…
The program output is also shown below.
- #include
- #include
- using namespace std;
- char caesar(char);
- int main()
- {
- string input;
- do
- {
- cout
- cout
- getline(cin, input);
- string output = “”;
- for (int x = 0; x
- {
- output += caesar(input[x]);
- }
- cout
- }
- while (!input.length() == 0);
- } //end main
- char caesar(char c)
- {
- if (isalpha(c))
- {
- c = toupper(c); //use upper to keep from having to use two seperate for A..Z a..z
- c = (((c – 65) + 13) % 26) + 65;
- }
- //if c isn’t alpha, just send it back.
- return c;
- }
