subject

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.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:30
Write code using c . (take input from user) calculate the size of a given file in kbs. in this task you will complete the function with the following prototype: float get_file_size(char * filename); the function takes the file name (address to the start of a null terminated character array) as input. the function should then open the file and find the number of bytes it contains till eof. the number of bytes divided by 1024 will give the size in kbs. if the file cannot be opened the function should return -1.
Answers: 2
question
Computers and Technology, 23.06.2019 22:20
Learning sign language is an example of a(n) learning sign language is an example of a(n)
Answers: 2
question
Computers and Technology, 25.06.2019 08:30
In the context of intentional computer and network threats a is a programming routine built into a system by its designer
Answers: 2
question
Computers and Technology, 25.06.2019 11:30
How do you put a picture with your question? i need to put a picture with my question
Answers: 1
You know the right answer?
Create a program that applies a simple "substitution cipher" to the contents of a text file and writ...
Questions
question
Mathematics, 15.06.2021 05:50
question
English, 15.06.2021 06:00
question
Mathematics, 15.06.2021 06:00
Questions on the website: 13722360