Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question

C++ program

Write a program that will include a method for encrypting a string and a method to decrypt a string. An "encrypted" string is a string that has been altered based on a formula so it is no longer understandable. This string can also be "decrypted" to return the value of the original string.

This program needs to have 3 methods - main(), a method to encrypt a passed string and return the generated results, a method to decrypt a generated string an return the results.

The encrypt and decrypt methods must be value methods that return results. No display related code is expected in these methods.

Do not use c-strings/char arrays in the assignment. Use the String class as described in section 10.7.

*************************

To encrypt a string, Add 1 to each character of the string. Thus 'A' becomes 'B', "X" becomes "Y", etc. To decrypt a string, reduce it's value by 1.

string myWord = "Hello World!";
string encryptedWord = myWord; // sets the same size

For each char - loop
encryptedWord[idx] = myWord[idx] +1;

********************************

The program must do the following:

  1. Prompt for a name
  2. Call the encrypt method and pass it the inputted name. Store and then display the returned results.
  3. Call the decrypt method and pass it the result from Step X. Store and then display the returned results results.
  4. The result of the decryption should match the original input.
  5. The program will loop and prompt me to continue.



Expert Solution
Check Mark
Step 1

C++ code for encryption and decryption

Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY