Comp 1671
Homework 7
Assigned 10/23/2002
Due Tuesday, October 29, 2002

First do these problems from the textbook:
Chapter 7: 1a-h, 2, 4, 6, 7

Then do these:
A. Say the function ChangeX is as follows:
   void ChangeX()
   {
      static int x=2;
      x += 2;
      cout << "x = " << x << endl;
   }
   Say this function is called 4 times.  What is the output?
   Next say that I modify the function as follows:
   void ChangeX_version2()
   {
      int x=2;
      x += 2;
      cout << "x = " << x << endl;
   }
   Again say that the function is called 4 times.  Now what is the ouput?

The link below contains an incomplete program that turns a message
(a word) into secret code.  The letters are shifted down the alphabet
by an amount given in the secret "key".  For example, if the key is 5,
then an "a" becomes "f" and a "z" becomes "e".  Most of the program has 
already been written.  You just need to fill in a few lines, or modify
a few lines. 

B. Add code for the function prototype and the function calls so that
the program asks the user for the text, asks them whether they want to
encrypt or decrypt, asks them for the key, then outputs the encoded or
decoded message.

C. Modify the code so that it also "cryptanalyzes", in other words, helps
   the user figure out the original message even if they don't know the
   key.  Ask the user if they want to encode, decode, or analyze.
   If they choose to analyze, then decrypt the
   message with all possible keys and output all 26 results.  The user can
   scan this output and select the message that makes the most sense.

Incomplete source code for problems A and B.