Programming Assignment 2
Contents
Overview
In this PA, you will create a message cipher which will allow both encrypting and decrypting a message. I will assign you the particular cipher to implement. Your program will take a text file as input, run it through the cipher, and write the encrypted output to a different text file. The program will also run in reverse, taking an encrypted file as input, running it through the decipher, and writing the output to another file. You will use command line arguments to read in the input and output file names, as well as whether the user wants to encrypt or decrypt the input file. A starter program is provided to help with the aspects of the program that we haven't gotten to in class.
For example, suppose I am assigned a transposition cipher that transposes the characters in every distinct adjacent pair of characters in the input text. Supposing I have the following text in a file named message.txt:
The quick brown fox jumps over the lazy dog.
Running my program as follows:
$ hanks-cipher -e message.txt encrypted-message.txt
will create the file encrypted-message.txt with the following content:
ht euqci krbwo nof xujpm svoret ehl za yod.g
To decrypt the encrypted text and save it to a file name original-message.txt, I would do:
$ hanks-cipher -d encrypted-message.txt original-message.txt
The contents of original-message.txt are the same as message.txt:
The quick brown fox jumps over the lazy dog.(Back to top)
Specifications
Your completed submission must meet the following requirements:
- (10pts) the code is well formatted (correct indentation)
- (10pts) the code has a header with the student's name, date, a description of the program, how many hours you spent on it, and lists who the student sought help from (see below)
- (10pts) comments are included to explain the code
- (10pts) the code is clean and efficient
- (20pts) the program compiles
- (20pts) the program runs smoothly: it doesn't crash, it is clear what information the program is asking for from the user, and the behavior of the program is as expected based on the given inputs
- (20pts) the cipher and other TODO implementations are correct, clean, and efficient
- the program should be your own work (copying work from other sources, including classmates, is plagiarism)
You can find the starter code in the Zovy class folder under the name pa2-starter.cpp.
(Back to top)Submission
Submit your .cpp file here.
(Back to top)