Implement a simple shuffle-encryption program this program

Implement a simple shuffle-encryption program. This program will change the contents of a user-selected file so that pairs of characters are exchanged (making the file fairly difficult to read). If the program is used to re-process an encrypted file, the file should end up readable again, since all character pairs will be exchanged back into their original positions.

In order to "change" the contents of a file, your program will need to read the file's contents into an array of strings, close the input stream, modify the contents of the strings in the array, then open the file again for output and write the new strings into the file (this will erase the file's prior contents).

If the file has too many lines to fit in your array, abort the process - do not destroy the file by writing out only part of it.

Recall that I mentioned in class that strings contain arrays and size variables. They "behave" like arrays in that you can use subscripting/indexing (the [] operator) on strings to access and change individual characters in the string. You can find out the size (number of characters) in a string by calling its size method (a function owned by the string, like cin's ignore method).

For example, if I wanted to print the contents of a string backwards, I could use:

for ( int i = myString.size()-1 ; i >= 0 ; i-- ) cout << myString[i];

You can test your program on any file containing text. You might recall that, in a class example, I read the contents of one of the program source files. Since your program will be changing the file contents, this would not be a good idea, just in case something goes wrong. Use some other text file (I made a copy of one of the program's source files to use for testing...).

The executable program Gold10.exe demonstrates what your program should do. It has an array size limit of 50, if you want to try that aspect.

I am sorry that there is no option to attach a file. That's why I can't attach the Gold10.exe file. I have never seen this type of tough problem as it is my first programming course. I really need help to complete it. Thanks in advance.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Implement a simple shuffle-encryption program this program
Reference No:- TGS02912413

Expected delivery within 24 Hoursrs

2015 ┬ęTutorsGlobe All rights reserved. TutorsGlobe Rated 4.8/5 based on 34139 reviews.