Implement a simple shuffle-encryption program

Assignment Help Computer Engineering
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.

Reference no: EM132118959

Questions Cloud

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.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Draw specific lessons and recommendations from your analysis

Draw specific lessons and recommendations from your analysis of the case as part of the conclusion, and have a strong concluding paragraph.

  Explain inclusion property and memory coherence requirements

Explain the inclusion property and memory coherence requirements in a multilevel memory hierarchy. Explain basic concept of paging and segmentation in managing.

  Code memory contents of code address instruction

make Use of the nine PAL instructions listed below to solve the problems.

  Retracing what do you mean by retracing define horizontal

what do you mean by retracing? define horizontal as well as vertical retracing.draw neat and clean diagram where

  How to use ms access and create a database

How to use MS Access and create a database

  Declare a class with name cubicle

Declare a class with name Cubicle. The name stands for any rectangular prismatic solid body having three dimensions, i.e. length, width, and height.

  Describe windows server core and what it is

Describe Windows Server core, what it is, what security benefits it provides, both in general but especially when compared to other Windows 2008 editions

  Write some code that will fill an array a with twenty values

Write some C++ code that will fill an array a with 20 values of type read in from the keyboard.

  Express the role of a web server

Describe the functions of layered Web architecture.express the role of a Web Server.

  Write a class that represents a spaceship

Write a class that represents a spaceship, which can be drawn (side view) in any particular location. Create a program that displays the spaceship.

  Select what technologies you feel would be appropriate

select what technologies you feel would be appropriate (cost-wise and maintenance-wise) for a site's implementation.

  Write a method public static measurable maximum

Write a method public static Measurable maximum(Measurable[] objects) that returns the object with the largest measure.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd