Question: Write a c++ program that will prompt the user to input a string of characters and prints an encrypted message back to the user as
Write a c++ program that will prompt the user to input a string of characters and prints an encrypted message back to the user as a string of ascii value base 2 , or it could be the other way round, promt the user to input an ASCII value in base 2 which then prints the decrypted string of character backs to the user. Here is an example: Do you want to encrypt or decrypt a message: encrypt Enter the string to encrypt: pet 01110000 01100101 01110100 Repeat again ? (y or n)? y Do you want to encrypt or decrypt a message: decrypt Enter the string to encrypt: 01110000 01100101 01110100 pet Repeat again ? (y or n)? y If the user wishes to input a string of text e.g hello world, it must be able to successfully decrypt it. Print an error message when: The encrypted message (binary) cannot be separated into bytes The encrypted message (binary) isnt 1s and 0s Not using the extended ASCII chart (128-255). Make sure the binary numbers will produce characters within 0-127. After error message keep prompting using to enter correct binary number. Create using this 4 function: 1: Create a bin_to_ascii() function that takes a string of 1s and 0s as input and prints/returns the binary string as an ascii character. 2: Create a ascii_to_bin() function that takes an ascii character as input and print/returns the character as a binary value. 3: Create a get_user_inpu() function that gets the input from the user. 4: Create a check_bin_number() function checks that the user entered a binary number meeting the three requirements specified above. No global variables are allowed in this case.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
