Reference no: EM132118959
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.
What are some security concerns when using mobile code
: Explain the following terms: boot sector virus, meme virus, stealth virus, multipartite, macro virus, script virus, and tunneling virus.
|
Define encapsulation and abstraction and polymorphism
: What is object oriented programming and what benefits does it provide. Define encapsulation, abstraction and polymorphism.
|
How many bytes of memory is this
: Suppose you discover that RAM addresses 000C0000 to 000C7FFF are reserved for a PC's video adapter. How many bytes of memory is this?
|
What effect will seamuss death have on the partnership
: HI6027 BUSINESS & CORPORATIONS LAW - Explain what type of company you would apply to register with ASIC, how that company would be categorised
|
Implement a simple shuffle-encryption 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.
|
Evolution of cyanobacteria and autotrophs
: Predict how that might have affected the changes in the atmosphere and the evolution of cyanobacteria and other autotrophs. Explain your answer.
|
How is a canary used to prevent stack smashing attacks
: How is a canary used to prevent stack smashing attacks? How was Microsoft's implementation of this technique, the/GS compiler option, flawed?
|
Make a math model and the hash function implementation
: Make a math model and the hash function implementation to automata system with a walking bomb and a walking robot.
|
Transport of materials across call membranes
: Contrast the physical processes of simple diffusion and osmosis with the carrier mediated transport of materials across call membranes.
|