Write a C++ program that encrypts a text file, using the following encryption sc
ID: 3762415 • Letter: W
Question
Write a C++ program that encrypts a text file, using the following encryption scheme.
1. Ask the user for the name of the original file.
2. Ask the user for the name of the output file.
3. Ask the user for the encryption key, n .
4. Read n2 characters from the file into the first n rows and n columns of a 2 dimensional array.
5. Transpose the array. (Exchange the rows and columns.)
6. Write the characters from the array to an output file.
7. Repeat steps 4 – 6 until the input file has been read.
This same program can be used to decrypt a file that has been encrypted in this way.
The program should have functions for performing the following tasks.
A. Reading the characters from the file into the array. This function should be passed the file stream, the array and the key.
B. Transposing the array. This function should be passed the array and the key.
C. Writing the characters from the array to the file. This function should be passed the file stream, the array and the key.