## CSCI 1300 - Programming Assignment 6 Decoding Secret Messages

Dates:

• Start: As soon as possible.
• Due: Wednesday, October 13
• Late work accepted without penalty: Thursday, October 14.
• Late work accepted with penalty: Through Saturday, October 23.
• No work accepted after October 23.
• For your next programming assignment, you must first complete Lab Exercise 6. The assignment is to modify the copyints program so that it can be used to decode messages that are written in the ASCII code. The ASCII code is the way that most computers store characters. The code assigns a small integer to each printable character. For example, the character ‘A’ is assigned the integer 65. The computer can easily convert back and forth between integers and the corresponding character. Here are a couple of examples:
```int i;
char c;

c = 65; // Assign the character which has ASCII code 65
cout << c; // This will print the character A

cout << "Type an integer: ";
cin >> i;
c = i;
cout << c; // This will print the character that has the ASCII
// code typed by the user.
```

• Start by copying the copyints.cxx to a new file called decode.cxx. (You do this from the DOS prompt, with the copy command: copy copyints.cxx decode.cxx).

• Put your name "Modified by..." at the top of the new decode.cxx file.

• Then modify decode.cxx so that instead of writing the integers to the output file, each integer is converted to it’s corresponding character and the character is written to the output file. Do NOT place an endl after each character. Do a careful reading of all documentation, and change this documentation to match your modifications.

• After you have completed that first modification, make one further change: During the input process, keep track of the number of times that you see each input number. These numbers range from 0 to 127. When the output message is completed, write an extra table to cout to indicate how many times each input number appeared. For example, one line of the table might look like this:
```The number 65 appeared 42 times in the input.
```
NOTE: Each line of the output must look exactly as shown above. Otherwise, you'll lose points in Dora's tests.

• When you have made both of the modifications, run your decode program with the input file message.dat. Submit the program to Dora in the usual manner.

• We're almost ready for class projects!