Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ /// Please use the template that is posted below Please use this template #include #include using namespace std; int main() { //declare variables to

C++

/// Please use the template that is posted below

image text in transcribedimage text in transcribed

Please use this template

#include #include using namespace std;

int main() { //declare variables to store user input bool cont = true;

//implement a loop so that it will continue asking until the user provides a positive integer // the following provides ONLY part of the loop body, which you should complete { cout

//declare a dynamic array of string type with the specified number of elements

// while(cont) { cout

case 3: //Print // Print out the encrypted words

break;

case 4: cont = false; break; default: break; } } // Remember to release the memory you allocate above!! return 0;

}

Objective Agent James Vond, one of our secret agents, Agent 008, has recently been captured in the Caribbean. We have been able to establish contact with him, but need help sending him messages in secret to let him know help is on the way. We believe we can send him messages using a Caesar Cipher, but need your help encodingit. Agent Vond, we task you with encrypting the message and helping Agent 008 escape the Caribbean Sincerely, M Assignment: The Caesar Cipher technique is one of the earliest and simplest method of encryption. It's a substitution cipher, i.e., each letter of a given text is replaced by a letter some fixed number of positions down the alphabet. For example with a shift of 1, A would be replaced by B, B would become C, and so on. The encryption equation is E(x)-(x + n) % 26 The x = the numeric letter value, n range (0-25) number of shifts, and (% 26) is so that whatever value your result is, it will stay within the alphabet However, since we will be looking at characters in strings, you need to implement ASCll code so that your equation will look more like letter-(( (letter-A') + shift ) % 264 A')) if it is upper case letter-(( (letter-a) + shift ) % 26 + a') ) if it is lower case You subtract 'A' and'a in order to get the value of the letter. In ASClIl code, letters are assigned values. For example, 'B' is 66. If I subtract the value of A' (65) then I get 1. This helps me encode because I can get the values 0-25 for each letter Your assignment is to implement a dynamic string array in order to store a message of variable length, and then a pointer to iterate through each letter of the string in order to encrypt it using the equations given above You will need to ask the user for the amount of words in the message and then create your dynamic array that way. If the amount of words is a negative number or equal to zero you should output to the screen "Invalid value. Please Re-enter a number of positive value' until they have the correct input. Get Message Use cin to get each word the user wishes to put into the message After they have input all the strings required, ask for the number of letter shifts they would like to do Encrypt Encrypt each letter in each string using the equations provided above if the getMessage pointer isn't null (aka if Get Message option has already been called) Print Message Print out the encrypted or unencrypted message Quit Simply quits out of the loop Input: You many assume that the input to be encrypted will only consist of capital and lower letters, and no other symbols such as white spaces numbers, or special characters will have to be encrypted n order to choose the different options you will take an integer value as input. 1 is for Get Message, 2 is for Encrypt, 3 is for Print, 4 is for Quit Requirements Use a dynamic array to store a message of variable length (not using dynamic array will receive 50% penalty) Use a pointer to iterate through each string and encrypt it Do not allow for number of letter shifts to be>26 (Must be in the range of 0-25 aka the range of 26) [Ex: If I give you 27,your shift should end up being 1] [Hint %] Do not expect int to hold all possible values when l input the value of shift, test very large numbers Print out your message using pointer arithmetic (ex: *p: p+) DO NOT iterate through your pointer like an array when printing

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

Step: 3

blur-text-image

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

Essential Data Protection For Estate Agencies In Singapore 2024

Authors: Yang Yen Thaw Yt

1st Edition

B0CQK79WD3, 979-8872095392

More Books

Students also viewed these Databases questions

Question

Describe some of the ways that sexual development varies.

Answered: 1 week ago

Question

What is Centrifugation?

Answered: 1 week ago

Question

To find integral of ?a 2 - x 2

Answered: 1 week ago

Question

To find integral of e 3x sin4x

Answered: 1 week ago

Question

To find the integral of 3x/(x - 1)(x - 2)(x - 3)

Answered: 1 week ago

Question

What are Fatty acids?

Answered: 1 week ago

Question

explain what is meant by redundancy

Answered: 1 week ago