Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ questions! Please don't use strange method or functions! The rebellion needs your help! In mere moments the ship you are riding in wi be

C++ questions!

Please don't use strange method or functions!

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

The rebellion needs your help! In mere moments the ship you are riding in wi 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 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 Example messages to encrypted ciphertext messages, as well as decrypt ciphertext messages 1. Take the English alphabet ABCDEFGHIJKLMNOPQRSTUVWXYZ 2. Define how far to rotate: (+3 in this example) 3. The cipher is: DEFGHlJKLMNOPQRSTUVWXYZABC; where plaintext 'A' ci- phertext 'D', plaintext 'B' ciphertext E', and so on. 4. Input a message in English: HELP 5. To encrypt, translate that message using the cipher. H-+ K, E H, L O. P S 6. HELP KHOS 7. To decrypt a ciphertext message, translate it back into English by reversing the pro- cess. For example, with rotation amount +3. KHOS HELP. Your task is to write a C++ program that will have: 1. Input: (a) Prompt the user to encrypt (e/E) or decrypt (d/D). (b) Prompt the user for an amount to rotate by (0 - 25) i. For example, 0 would mean the message remains clear text A - A ii. For example, 25 would mean that A - Z (c) Prompt the user for a message. . Output: (a) Decrypt or encrypt as appropriate and print out the translated 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? badrotation INVALID ROTATION... TERMINATING Some additional rules and guidance: The program must handle both encryption and decryption 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 *The error message should print after all input prompts. *After printing the error message the program should terminate. This can be done with either return 1 or exit(1) The USER must be able to specify the rotation amount (as a number between 0 and 25, inclusive) . The application should do some validation on the rotation amount The application should do some validation on the rotation amount IF the rotation amount is > 25 or

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions