Write the string to the ofstream

Assignment Help Basic Computer Science
Reference no: EM13307840

1. You must ask the user if they want to perform an encryption or decryption operation. 2. You must ask the user to enter the name of the file they want to encrypt or decrypt. 3. You must get an encryption key from the user which can be up to 128 characters. The key must be all lower case alphabetic characters. 4. You must have a function which takes the encryption key and creates an encryption map from it. For each character in the encryption key string, subtract the lower case letter 'a' and store the result in the corresponding encryption map array. 5. You must have a function which takes the encryption key and creates a decryption map from it. For each character in the encryption key string, subtract the lower case letter 'a' from it. Then subtract that result from 26 and store the value in the corresponding decryption map array. 6. You must have a function which will do the encryption or decryption transformation. This function takes the following parameters: A constant C string containing the line of text to be transformed. A constant C character array which contains the encryption or decryption map. An integer which contains the length of the encryption map. A string reference (output) which will contain the encrypted or decrypted string upon completion. The core of the encryption / decryption algorithm is as follows: For each character (the ith character) in the text input line do the following: if the character is not alphabetical, add it to the end of the output string if the character is lower case alphabetical subtract the character 'a' from the character get the ith % map length element from the map and add it to the character adjust the value of the character % 26 to keep it within the alphabet add the character 'a' to the character add the encrypted character value to the end of the output string if the character is upper case alphabetical do the same thing as for lower case except use 'A' instead of 'a' 7. For decryption, the main program should create an ifstream for the file to be decrypted. It should use the getline method of the ifstream to read lines from the file, call the encryption / decryption function with the line to be decrypted, and display the string which contains the result of the encryption / decryption function call. Repeat until the ifstream reaches the end of the file, then close the ifstream. 8. For encryption, the main program should create an ifstream for the file to be encrypted. It should also create an ofstream for the file where the encrypted result will be stored. The file name for this file can be gotten from the user or can be the input file name with a special extension added at the end. The getline method of the ifstream is used to read lines from the input file. Then the encryption / decryption function is called to encrypt the line. Display the string containing the result and write the string to the ofstream. Close the ifstream and ofstreams when finished. 9. Make sure that your program allows the user to encrypt / decrypt more than one file per session. This means adding a loop which allows the entire program to repeat until the user has nothing more to do.

Reference no: EM13307840

Questions Cloud

Explain in detail your objectives for each media form : 1.Describe the mix of media you would use to implement your public relations campaign and explain in detail your objectives for each media form.
What is the most likely cause of the problem : Some time later, Leo calls you back to tell you that while he is able to access the Trinity folder and read the files stored there, he has been unable to save changes back to the server. What is the most likely cause of the problem?
Can one collector be temporarily taken out of service : Dust is removed from the airstream of a municipal incinerator by four dust collectors operating in parallel, each handling 1/4 of the total airflow of 200 m3/min. The airstream contains 10 g/m3 of suspended solids.
Determine the resultant work done on the car : A 1500 kg car increases its speed from 15 m/s to 18 m/s in 15 seconds. What is the resultant work done on the car
Write the string to the ofstream : Close the ifstream and ofstreams when finished. 9. Make sure that your program allows the user to encrypt / decrypt more than one file per session. This means adding a loop which allows the entire program to repeat until the user has nothing more ..
Explain how to develop a project charter : Using the above scenario, develop a project charter. Include the problem statement, justification for the project, and how the project will be measured for success.
Find the value of the magnetic field at the center of ring : consider a thin wire bent into the shape of a ring of radius of 10 cm that carries a steady 2.0-A current
Evaluate the strategy that led to the merger or acquisition : For the corporation that has acquired another company, merged with another company, or been acquired by another company, evaluate the strategy that led to the merger or acquisition to determine whether or not this merger or acquisition was a wise cho..
What is the peak voltage of the generator : The rms current in a solenoid is 0.036 A when the solenoid is connected to a 18 kHz generator. What is the peak voltage of the generator

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Evaluation process to seven-step acquisition model

Discuss in scholarly detail the acquisition evaluation process to the Seven-Step Acquisition Model.

  Explaining paper on reconnaissance planning

Write a paper on reconnaissance planning. The paper is explaining the network and reconnaissance plan.

  Explaining process of making changes as recursive

You can view the process of making changes as recursive. You first see if any dollars are required, subtract them from the total, and then make change for what remains. Complete the LISP program to achieve the above requirements.

  How does cpu interface with device to coordinate transfer

Direct memory access is used for high-speed I/O devices to avoid increasing the CPUÂ ´s execution load. How does CPU interface with device to coordinate transfer?

  How could a business use information technology

How could a business use information technology to increase switching costs and lock in its customers and suppliers? Use business examples to support your answers

  Compute the global boolean or of all input values on ring

Consider an anonymous ring of size n. Each node v stores an input boolean value i(v). When the algorithm terminates, then every node is to store the output in its private variable. Every node knows n, in that n can be a part of code.

  Define static binding and dynamic binding

1. Define static binding and dynamic binding and give an example of each. Static binding occurs at compile time and dynamic binding occurs at run time. 2. Describe a situation when a history sensitive variable in a subprogram is useful.

  Design a class for representing a rectangular grid

Design a class for representing a rectangular grid and use it to allow a user to query a grid interactively as part of a game.

  What type of hardware is needed to support t-1 connection

What kind of hardware is needed to support a T-1 connection to your business? You want to write a song and apply a digital signature to it, so that you can later prove that it is your song.

  Constructs an internal linked representation of the tree

Output Your program must print a string representing the postorder traversal of the tree followed by a newline character.

  Sort the array into descending sequence

Call an iterative sum method to sum the values in the array. Print this total and use it to desk check the total developed by the recursive sum method.

  Compute the mean and standard deviation of the rolls

Also, your application should show a table that shows each possible roll of the dice and its frequency of occurrence in the simulation in a listbox. In other words, the table shows the count of a roll of 2, the count of a roll of 3, and so on up t..

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