Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

image text in transcribed

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

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago