A22.0002

ASSIGNMENT 7

Due: Thursday, June 24th (The day of the final)


Write a program which DECRYPTS the secret messages which are created by the ENCRYPT program which we created in class.

It should first prompt the user for the scrambled alphabet which was created by ENCRYPT. It then should ask for the secret message. Finally, it outputs the unscrambled version.

Note that there are exactly 26 characters input for the scrambled alphabet, so you can use a FOR loop. All alphabetic characters are translated into their decoded equivalents (which will take a WHILE loop), and all other characters should be output exactly as they were without translation.

For extra credit, verify that the scrambled alphabet you input has only alphabetic characters and that they don't duplicate. Put out an error message if you find a duplicate letter.

Here is a possible sample run:


Please input the scrambled alphabet in order:
XQHAJDENKLTCBZGUYFWVMIPSOR

Now input the scrambled message:
VNKW KW BO 1WV WJHFJV BJWWXEJ!

Your unscrambled message reads:
THIS IS MY 1ST SECRET MESSAGE!