Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following is some code to help you get started: This is a C++ problem. Please give full explanation and code in details. Thanks, A
The following is some code to help you get started:
This is a C++ problem. Please give full explanation and code in details. Thanks,
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 -> HELF. 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 A-A 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. If the rotation is> 25 or 25 or HELP 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 cstr.at (0) 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. #includeStep 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