Computers and Technology

Create a program that applies a simple "substitution cipher" to the contents of a text file and writes the encrypted text back to the file. A substitution cipher is given a key word and uses the unique characters from that word to generate a cipher alphabet. Suppose "feather" is used as the key. The following cipher alphabet will be generated: FEATHRZY X W V US OPON MLKJIGD CB A B C D E F G H I J K L M N O P Q R S T U V W X Y Z FEATHRZY X W V USO PONMLKJIGDCB Using this cipher alphabet, read in a text file and replace each character with the corresponding cipher alphabet character (e. g., A -> F) when encoding and vice versa when decoding. In addition to being able to encode or decode, your application should utilize command line input parameters, with the following format: passing -e/-d to your program will cause the file to either encrypt or decrypt using the specified key. passing -k followed by a word will specify the key (e. g., -k feather) (you can use any word for the key you want). the last two strings will denote the input file and output file, respectively. Example: ./test -e -k feather input. txt output. txt
Assuming your compiled program was called "test", this line will read in input. txt, encrypt the text using the cipher alphabet generated by feather to the contents and write them to output. txt. Note: you will only apply the encryption alphabet to characters and leave spaces and punctuation alone. Hints: Use the file stream objects for reading and writing to your files. Use the getline() member function of the file streamer to get entire lines of strings from the input source. Don't forget to use the library for helpful functions for analyzing command line parameters. Also, when developing your cipher encryption, save dealing with capital letters for last. It's an easy conversion that can be applied during the encryption/decryption process.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 16:30, mirandac7747
You have inserted new slides based on a word outline. how do you format these new slides to match the powerpoint presentation formatting? a. select all slides in the presentation and click format on the home tab. b. select the new slides and click reset on the home tab. c. select all slides in the presentation and click reset on the home tab. d. select the new slides and click format on the home tab.
Answers: 2
image
Computers and Technology, 23.06.2019 07:00, sugaree95
What are three software programs for mobile computing?
Answers: 1
image
Computers and Technology, 23.06.2019 08:00, Buddy01
Match the items with their respective descriptions.
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, juliajordan427
Best laptops for college [$100-$500 range]?
Answers: 2
Do you know the correct answer?
Create a program that applies a simple "substitution cipher" to the contents of a text file and writ...

Questions in other subjects:

Konu
Social Studies, 06.10.2019 16:30
Konu
Mathematics, 06.10.2019 16:30