There are many methods to encode messages. In this problem, you will write programs to encode and decode messages in one of these methods, the Vigenère cipher. In this method, we are given 26 rows of strings - each string has 26 characters. Each row is a permutation of the letters of the alphabet, i.e., each letter appears once and only once in each row. We are also given a secret word called the key. We write the key above the plain text message we wish to encode repeating it as many times as necessary. For each character in the message, we use the letter in the key to choose a row of the array and the letter in the message to choose a position in the string. We replace the letter of the message with the letter we find in that row and position. Consider the following example:
Suppose the key is "LAX' and the array of strings is:
ABCDEFGHINJKLNOPQRSTUVWXYZ
A BCDEAGHIJFLMNOKQRSTPVWXYZU
B BCDEFGHIJKLMNOPQRSTUVWXZYA
C CJDEFGHIKLMNOPQRSATUVXBYZW
D CDENFGHIJKLMOPQRSTUVWXYZBA
E FEGAHIJKLBMNOPQRSCTUVWXYZD
F EFGHIJKLMNOPQSRTUVWXYZADBC
G CDEFGHIJKLMNOPQRSUTVWXYZBA
H GHIJKLMNOPQRBSTUAVWXCYZDFE
I DEFGHIAJKLMNOPQRCSTUVXYZBW
J CDEFGHIJMNOPQRASBTUVWXYZLK
K BCDFGHIJKMNOPQRSTUVWXYZLEA
L CDEGHIJKLNOPQRSTUVWXYZAMFB
M GHIJKLMNOPQRSTUVWXYZFEDCBA
N ZYABCDEFGHIJKLMNOPQRSTUVWX
O YXZABCDEFGHIJKLMNOPQRSTUVW
P EFGHIJLMNOPQRSTUVWABCDXYZK
Q ZWYXABCDEFGHIJKLMNOPQRSTUV
R VXYWZABCDEFGHIJKLMNOPQRSTU
S JIABCDEFGHKMNOPQRSTUVWXYZL
T PQABCDEGHJKLMNORSTUVWXYZIF
U MNABCDEFGHIJKLOPQRSVWXYZUT
V BCDFGHIJKLMOPQRTUVWAXYZSEN
W DEFHIJKLMPQRSTUVWXYZCOGNBA
X BCEFGHIKLMNOPQRSTUVWXYZADJ
Y BCDEFGHJKLMNOPQRSUVWXYAZTI
Z CEFGHIJLMNPQRSTUVWXYZBADKO
Then the message "SENDHELP" will be encoded as "WAQGIGPQ" since the (L,S) entry in the table is W, the (A,E) entry is A, the (L,D) entry is G, the (A,H) entry is I, the (X,E) entry is G, the (L,L) entry is P and the (A,P) entry is Q.
Write a program which declares a 26-element vector of strings and a variable to hold the key word, reads the key word and the vector from the file vig.cpp on the n drive, and writes the keyword and the vector on the screen.
Expand your program in part A by adding code which will read from the screen until the eof on the screen and then will encode what it reads using the Vigenère cipher and the key word and vector read from the file vig.cpp. Write the encoded message to the screen.
Expand your program in part A by adding code which will read from the screen an encoded message until the eof on the screen and then will decode the message. Write the decoded message to the screen.