"Cipher"
A coded message has been prepared using a standard, constant key replacement technique. For every letter in the original, uncoded message a different letter is chosen and the replacement letter is substituted in every position the original letter appears. For example, the message COMPUTER SCIENCE may be encoded as MQWLDXZG YMUZKMZ.
A solution to the code makes use of a feature of written English called "letter frequency." The frequency with which certain letters appear is relatively constant, with the letter 'E' appearing most frequently and the letter 'Z' appearing least frequently. The frequency chart is given below:
E T A O N R I S H D L F C M U G Y P W B V K X J Q Z
E T A H O S I N R D B L M W G U C Y F J K V P X Q Z
Modify your struct, by adding a field to your struct so that each of the read-in letters would be associated with the above frequency list. As you read in the file for the second time, make the substitutions and print out the uncoded message to a file.
What modifications would you need to make to your lab to enable it to encrypt a message as well as decrypt?