Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C++ program that encrypts/decrypt a file using Caesar Cypher. The program should be able to encrypt and decrypt all characters including white spaces.
Write a C++ program that encrypts/decrypt a file using Caesar Cypher. The program should be able to encrypt and decrypt all characters including white spaces.
. . Write the following functions: A function to display a menu. A function that obtains a key value between 1 and 10 A function to encrypt. It should ask the user for the input file name and output file name, read text from the input file, and output the encrypted text to the output file. A function to decrypt. It should ask the user for the input file name and output file name, read text from the input file, and output the decrypted text to the output file. Both encryption and decryption functions should take a key parameter. Print an error message if any of the files fail to open. Encryption: The shift key is used to modify each character by adding the key value to the character. Decryption: Reverses the process of encryption. The shift key is used to modify each character by subtracting the key value from the character. Hints: Use inputStream.get(to read each character. This will allow you to read white spaces. Use the following main program: int main() { int choice, key; key = 3; //default do { displayMenu(); cin >> choice; if (choice == 1) { // call the set key function and assign to key } else if (choice == 2) { //call the encryption function } else if (choice == 3) { //call the decryption function } } while (choice != 4); return 0; }Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started