Question: youll decrypt a secret message using a cipher. A cipher is a program that converts a message in normal text into a secret message, and

youll decrypt a secret message using a cipher. A cipher is a program that converts a message in normal text into a secret message, and viceversa. For example, the normal message meet at five pm might be converted to the secret message [@@, !, (#<@ ][ using a cipher. The secret message can be sent to a friend. Nobody else could read the message, expect the friend whose cipher would convert the secret message back to normal text.

The starter program decrypts the first character in a secret message if that first character is {.

The complete list of cipher and normal characters to decrypt a message: '!' > 'a' '^' > 'b' '&' > 'c'

'*' > 'd' '@' > 'e' '(' > 'f' ')' > 'g' '' > 'h' '#' > 'i' '_' > 'j' '=' > 'k' '+' > 'l' '[' > 'm' '{' > 'n' '$' > 'o' ']' > 'p' '}' > 'q' ';' > 'r'

':' > 's' ',' > 't' '%' > 'u' '<' > 'v' '.' > 'w' '>' > 'x' '/' > 'y' '?' > 'z'

1) Decrypt by hand the following secret message: {#&@

Then, modify the program to decrypt all instances of { in the secret message to n.

2) Modify the program to decrypt all instances of 3 more decryptions: & > c @ > e # > i

Your program should decrypt the following secret message: {#&@

3) Add the remaining 22 decryptions. Instead of coding 22 more branch statements, loop through the cipherV vector. Refer to the Multiple vectors section for an example of a program with two vectors.

Here is an example program execution (user input is highlighted here for clarity):

Enterasecretmessage:{#&@ Decryptedmessage:nice

Here is an example program execution (user input is highlighted here for clarity):

Enterasecretmessage:[@@,!,(#<@][ Decryptedmessage:meetatfivepm

Here is an example program execution (user input is highlighted here for clarity):

Enterasecretmessage:Y$%-!<@${&@!)!#{($#+@*[/]+!{: Decryptedmessage:Youhaveonceagainfoiledmyplans

this is the starter code....

#include

#include

#include

using namespace std;

int main() {

vector normalV(26);

vector cipherV(26);

string toDec = "";

string beenDec = "";

normalV.at(0) = 'n'; cipherV.at(0) = '{';

// Get secret message

do {

cout << "Enter a secret message: ";

getline(cin, toDec);

} while (toDec.length() == 0);

beenDec = toDec;

// Decrypt secret message

if (toDec.at(0) == cipherV.at(0)) {

beenDec.at(0) = normalV.at(0);

}

cout << "Decrypted message: " << beenDec << endl;

return 0;

}

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!