Question: The following is some code to help you get started This is a C++ problem. Please give full explanation and code in details. Thanks. The



The following is some code to help you get started

This is a C++ problem. Please give full explanation and code in details. Thanks.
The rebellion needs your help! In mere moments the ship you are riding in will be overtaken by the imperial fleet. We must get an encrypted message (a cipher text) off the ship and to our resources on the ground. We need you to create a Caesar cipher that can convert plaintext messages to encrypted ciphertext messages, as well as decrypt ciphertext messages back into plain text. A Caesar cipher is a mechanism of encryption where every letter in a message is rotated by a pre- agreed upon amount; thus scrambling the important message. Ex) 1. Take the English alphabet ABCDEFGHIJKLMNOPQRSTUVWXYZ 2. Define how far to rotate: a. +3 3. The cipher is: DEFGHlJKLMNOPQRSTUVWXYABC; where plaintext A' = ciphertext 'D, plaintext B' = ciphertext E', and so on. 4. Write down a message in English: HELP 5. To encrypt, translate that message using the cipher. H> K E->H,L>O, P-> S a. HELP->KHOS To decrypt a ciphertext message, translate it back into English by reversing the process. For example, with rotation amount +3, KHOS-> HELP. 6. Objectives: Write a C+program that will 1. Input: a. prompt the user to encrypt or decrypt. b. Prompt the user for an amount to rotate by (0 25) i. 0 would mean the message remains clear text AA ii, 25 would mean that A Z Prompt the user for a message Decrypt or Encrypt as appropriate and print out the translated message The program should prompt the user for all INPUT, then after the prompt and input is c. 2. Output: a. 3. Error Conditions: a. complete If the encryption/decryption mode is invalid, you must quit the program ii. If the rotation is>25 or 0 you must quit the program. i. Example 1 (user input is underlined) Encrypt (e/E) or Decrypt (d/D)? What is the cipher rotation value? 10 What is the message? Translated Message: ROVZWOYLSGKX Example 2 (user input is underlined) Encrypt (e/E) or Decrypt (d/D)? What is the cipher rotation value? 17 What is the message? Translated Message: VADERISLUKESFATHER Example 3 (user input is underlined) Encrypt (e/E) or Decrypt (d/D)? What is the cipher rotation value? -42 What is the message? INVALID ROTATION. .. TERMINATING Some Additional rules and guidance: The program must handle both encryption and decryption . o Prompt the user for 'e/E' or 'd/D -If the user inputs anything other than that, you must print the error message "INVALID MODE. . . TERMINATING " Then exit the program ' exit (1) .The USER must be able to specify the rotation amount (as a number between 0 - 25 (inclusive)) The application should do some validation on the rotation amount . "IF the rotation amount is> 25 orHELP ME PLEASE!-> HELPMEPLEASE A couple of tips: This application will use SEVERAL loops throughout the program. You can loop through a string using a for loop, and use the function at(position) to get the character value. o string str-"CLIFFORD"; o char c str.at (O) o c would equal C'://aka 67 ascii value You may find use in examining an ASCII table for hints on how to convert from lower case to UPPERCASE letters. Google 'ASCII table' for an example. Or the ASCII table is Appendix 3 in the textbook. When using cin and getline you must make sure to flush the buffer. To make this EASY on you, we have included some code to help you get started. It declares the 3 input variables and sets up the prompt. You will NOT need to modify the prompt, just starting your code below it. getline is used to get a string with whitespace in it. . using namespace std; int main() ( //START DO NOT MODIFY int rotate; char mode; string message; cout > mode; cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
