Question: A Caesar cypher is a simple encryption/decryption method that shifts letters by some given number of steps. For example, a shift of 1 takes A

A Caesar cypher is a simple encryption/decryption method that shifts letters by some given number of steps. For example, a shift of 1 takes A to B, B to C, and so on. It takes Y to Z, while Z rotates around to A. A shift of 2 takes A to C, B to D, and so on. It takes W to Y, X to Z, Y to A, and Z to B. Only letters are modified. Upper-case letters stay upper-case, and lower-case letters stay lower-case. So, a Caesar cypher with a shift of 3, applied to the string Hello, everyone! would become Khoor, hyhubrqh!. Instructions Write a complete C++ program that repeatedly inputs a line of text and an integer to be used as a shift. It applies the Caesar cypher with that shift to the text and outputs the result. There should be some way the user can end the program. The source code for the program should be in file caesar.cpp. Proper error handling should be done. In particular, if the user is asked to enter a number, and something else is typed, then the program should notify the user and retry the input. Sample Run A run of the program might look like this. Boldface text is that typed by the user. Caesar Cypher Enter a message to cypher (blank line to end): Hello, everyone! Enter an integer to use as the shift: 3 Result: Khoor, hyhubrqh! Enter a message to cypher (blank line to end): Khoor, hyhubrqh! Enter an integer to use as the shift: -3 Result: Hello, everyone! Enter a message to cypher (blank line to end): Program Complete

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!