Question: C++ Programming Consider the following scheme for encrypting a text file. The original file is split into two new files. One of the two new

C++ Programming

Consider the following scheme for encrypting a text file. The original file is split into two new files. One of the two new files will contain all the characters in the original file in odd position and the other new file will contain all the characters in the original file in even position. That is, the first file would contain the first, third, fifth, seventh, etc. characters from the original and the other file would contain the second, fourth, sixth, etc. characters. For example, if the original file contained the text: That's all folks! then the first file would contain: Ta' l ok! and the second file would contain: htsalfls

For this assignment you are to implement the encryption and decryption functions for such a scheme and write a driver program to test them.

The first function

void split(char sourceFile[], char destFile1[], char destFile2[]);

should:

1. Open sourceFile as an input file stream,

2. Open destFile1 and destFile2 as output file streams

3. Read each character from sourceFile and

4. If it's an even numbered character (starting at 0), place it in destFile1

5. Else place it in destFile2

6. Close the files

The second function

void merge(char sourceFile1[], char sourceFile2[], char destFile[]);

should reverse the previous process.

To test these two functions, your main function should do the following:

1) Ask the user for the name of the input file.

2) Ask the user for the names of the two half files.

3) Call the split function with the filenames as parameters.

4) Ask the user for the name for the recombined file.

5) Call the merge function with the appropriate filenames as parameters.

Your program should also:

Give detailed directions and warnings to the user.

Be readable with appropriate documentation and formatting.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!