Question: C++ Programming: We will write a simple program that uses file input/output to encrypt the contents of a file using the rot13 substitution cipher. You

C++ Programming:

We will write a simple program that uses file input/output to "encrypt" the contents of a file using the rot13 substitution cipher. You will accept two command line arguments, the input file and the output file. For example assuming input.txt exists and has data:

g++ rot13.cpp -o rot13

./rot13 input.txt output.txt

Now output.txt will contain the encrypted version. Running rot13 on output.txt will produce the original data.

This program will use several C++ features. You'll need if..else or switch statements for the character substitutions (e.g. in the case the letter is 'A', substitute it with 'N'). You will need file input/output, and loops to read the characters.

Define at least one function in your program -- do not give me a giant main function. You should have at least one function that does the lookup for the substitution.

Pseudo code is something like:

open input file and output file

for every character in input file

call substitution lookup function

write the substituted character to the output

As an example, the message "HELLO WORLD!" gets encrypted to "URYYB JBEYQ!" and decrypted back to "HELLO WORLD!"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!