Related questions
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.
C++ code for encryption and decryption
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images
- python3 program : Write a function that removes all spaces from a given string string and returns the new string.arrow_forwardIn python: The isUpper method converts a string to all uppercase characters True Falsearrow_forwardUSING ARROW FUNCTIONS IN JAVASCRIPT WRITE THE FOLLOWING CODEarrow_forward
- Text book imageComputer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONText book imageComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceText book imageNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Text book imageConcepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningText book imagePrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationText book imageSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY