subject

For this assignment you will be implementing simple rotation encryption to be used on a text file. Your program will need to read in text from a text file and encrypt or decrypt it (have the user select which) using the encryption key entered by the user, then write the results out to another file. The user will enter the names of the source and destination files, the encryption key, and will select whether they are encrypting or decrypting the file.
Rotation Encryption:
Rotation encryption involves shifting each letter in the encrypted passage forward by the amount of the encryption key. For example, if the string to encrypt is "Apple" and the encryption key is 2, the encrypted result is "Crrng". Decryption reverses the process by shifting each letter backward by the amount of the encryption key, so "Crrng" decrypts back to "Apple". Note that if someone were to have a copy of an encrypted file and your program, they could recover the original contents only if they also knew the encryption key (while this encryption could easily be "brute-forced," i. e. all possible encryption keys could be tried, real world encryption methods have many more possible encryption keys and decryption is a longer process, making this impractical).
Some notes for our implementation:
We will only be encrypting alphabetical characters, i. e. AZ and a-z. Any nonalphabetical characters should be skipped over and kept as-is by the encryption and decryption functions.
We will maintain case when encrypted, i. e. lowercase letters will remain lowercase and uppercase letters will remain uppercase.
If a character would encrypt or decrypt past the ends of AZ or a-z (i. e. beyond Z/z when encrypting or before A/a when decrypting) we will wrap it around to the other end (i. e. with encryption key 3, Y encrypts to B and decrypts back to Y, and y encrypts to b and decrypts back to y).
Your program should be split into functions. At a minimum, the following four functions must be implemented, though you may use others if desired:
A function that reads from a file (takes a single string parameter for the filename and returns a string).
A function that writes to a file (takes 2 string parameters, one for the filename and one for the contents to be written, return type of void).
A function that performs encryption (takes a string parameter for the string to be encrypted and an int parameter for the encryption key, returns the encrypted result as a string).
A function that performs decryption (takes a string parameter for the string to be encrypted and an int parameter for the encryption key, returns the decrypted result as a string).
Hint: Encryption and decryption are very similar – you might want to have your encryption function call your decryption function or vice versa, or write a third function that encryption and decryption both call in order to avoid repetition.
Note: Main should handle all user input. The encrypted or decrypted result is written to a file. Acceptable encryption keys are in the range 1-25 inclusive, you must validate the user’s entered encryption key and if it is out of range require that they re-enter it.
Submit the following to Cougar Courses:
Your code (all .cpp or .C file(s), and any .h files if applicable)
Screenshot(s) of your program having been compiled and then running on empress, including the compilation line (g++ …)
Contents of a sample file, before encryption, after encryption, and after decryption. (note: before and after should match if your program works properly). Save these as 3 text files, "original. txt", "encrypted. txt" and "decrypted. txt".

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 09:30
My mom and i are moving and we don’t have wifi for the next week, i want to know if using a using a hotspot with unlimited data is better than using regular wifi. i’m considering cost, speed, and data sacrifices.
Answers: 1
question
Computers and Technology, 22.06.2019 15:30
To increase sales, robert sends out a newsletter to his customers each month, letting them know about new products and ways in which to use them. in order to protect his customers' privacy, he uses this field when addressing his e-mail. attach bcc forward to
Answers: 2
question
Computers and Technology, 24.06.2019 02:30
Assume a class window with accessor method getwidth that accepts no parameters and returns an integer. assume further an array of 3 window elements named winarr, has been declared and initialized. write a sequence of statements that prints out the width of the widest window in the array.
Answers: 2
question
Computers and Technology, 24.06.2019 06:50
What are the things you are considering before uploading photos on social media?
Answers: 1
You know the right answer?
For this assignment you will be implementing simple rotation encryption to be used on a text file. Y...
Questions
question
History, 25.06.2019 22:30