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: Prompt for a name Call the encrypt method and pass it the inputted name. Store and then display the returned results. Call the decrypt method and pass it the result from Step X. Store and then display the returned results results. The result of the decryption should match the original input. The program will loop and prompt me to continue.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
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
Step 1

C++ code for encryption and decryption 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

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