CMPS 1044 – Program 4 - Encryption Substitution Cypher

advertisement
CMPS 1044 – Program 4 - Encryption Substitution Cypher
DUE – Friday, April 8 (Do not need to work on this over Spring Break. You should have plenty of time to
do this after we return.)
As discussed in class, program 4 is to implement a simple substitution encryption system. The list below
gives the substitution table and a short example. For this program you will implement the decrypt
function ONLY. That is, read in a cypher text, one character at a time, and print out the corresponding
message in plain text. The cypher can be in upper or lower case. That is, if you read E or e or ? convert
to A. You must use the switch command to implement the decryption.
You will need to use the “end of line” feature for the while loop of this program inside another while loop
for the file. We have not discussed this in class yet so if you want to get started, just assume 1 line of
some fixed number of characters as your test data.
Capitals & Lower Case are treated the same
Plain Cypher
A
E ?
B
I
C
@
D
A
E
H P
F
*
G
B
H
Q
I
T
J
F
K
R
L
S
M
G &
N
D
O
J %
P
U
Q
C
R
N
S
V M
T
^ #
U
W
VX
W
L
X
Y
Y
Z
Z
!
BL
K $
BL means blank space
Cypher text
QHSSJKGENZ
&Mw$Fwv#EdBV
Plain text
Hello Mary
MSU Mustangs
Download