Question: C++ Coding: 11.3 LAB: Convert String to Cyphertext cstring Implement the following (Called a Ceasar Cypher, since it was used in Ceasar's time) using this

C++ Coding:

C++ Coding: 11.3 LAB: Convert String to Cyphertext cstring Implement the following

(Called a Ceasar Cypher, since it was used in Ceasar's time) using

11.3 LAB: Convert String to Cyphertext cstring Implement the following (Called a Ceasar Cypher, since it was used in Ceasar's time) using this function prototype in the same file char* cypher (string str, int rotate) The idea is that you will declare a variable of type string and give it a value in main. Then pass it into the cypher function Cypher will create a cstring by copying the str to a new char* of size str.size0. Remember that you can covert with str.c.str() Then you will rotate ever letter by an amount passed into the function. If you look at the asci table You will see that A is 65 and z is 122. We want to keep every character between these ascii codes. So, you will probably need an if statement noting: If after adding the rotate value and taking the modulus of one after z (123), the value is between 65 and 123, then set the character to that value. Otherwise, because you did a mod of 123, you know the number is no larger than 122 (then goes back to zero)..so in that case you would want to add 65 to take it to A. Don't forget to return the char*. Then print out the cstring with puts. e.g char cstr new char[sizel; puts (cstr) For output, set the string to "ABC" and call cypher(ABC", 0) #include for test purpose result

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!