Question
In cryptography, a Caesar cipher, also known as a Caesar's cipher, or the shift cipher, is one of the simplest and most widely known encryption
In cryptography, a Caesar cipher, also known as a Caesar's cipher, or the shift cipher, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 3, A would be replaced by D, B would become E, and so on. The method is named after Julius Caesar, who used it to communicate with his generals.
Code a C++ program based upon the following constraints:
1. Get the plain text to be enciphered from the user, storing it in a variable of type string.
2. Get the positional shift value from the user and validate that the value is an integer whos value falls in the range of 1 to 255 inclusive (truncate any digits to the right of the decimal point).
3. Create a value returning function that will both encipher and decipher the text. This function will accept two arguments the plain text and the positional shift value.
4. Call this function from main() twice once to encipher the plain text and once to decipher the previously enciphered text. Do NOT store the original plain text to display after the last function call. Your program must both encipher and decipher. After each function call you shall output the resultant string returned from your cypher engine.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started