Write a c++ program for encrypting and decrypting files

Assignment Help Basic Computer Science
Reference no: EM13307087

Write a C++ program for encrypting and decrypting files. Since this program performs two different functionalities (encryption and decryption), prompt the user to select the type of cryptographic technique as shown below:

Welcome to the Cryptographic Techniques Program

Please enter your selection:
1. Encrypt
2. Decrypt

When the user selects 1 or 2, s/he will be asked to specify the input and output files.

This program will be tested using a .txt file.

If the user selects to encrypt the file (i.e. option 1), then the program will encrypt the original text and outputs the encrypted text to a new file.

If the user selects to decrypt the file (i.e. option 2), then the program will decrypt the encrypted text and outputs the decrypted text to a new file.

The program should give the user the option whether to continue with encrypting/decrypting files (i.e. entering letter 'C') or exit the program (i.e. entering the letter 'E').

This program MUST be written using functions and arrays.

The program MUST and can ONLY contain the following function definitions and layout:

 

/**************************************************************
* This function displays the menu options as in the handout *
**************************************************************/
void displayMenu()
{ /* function body */ }


/**************************************************************
* This function encrypts the content of infile and saves the *
* encrypted text into outfile *
* @param infile string (file that has raw text) *
* @param outfile string (file that will have encrypted text) *
**************************************************************/
void encrypt(string infile, string outfile)
{ /* function body */ }


/**************************************************************
* This function decrypts the content of infile and saves the *
* decrypted text into outfile *
* @param infile string (file that has encrypted text) *
* @param outfile string (file that will have decrypted text) *
**************************************************************/
void decrypt(string infile, string outfile)
{ /* function body */ }


/**************************************************************
* This function takes an character and a cipher key to return *
* an encrypted character. *
* @param c is a char (the character to be encrypted) *
* @param key is an integer (cipher key given in the handout) *
**************************************************************/
char ceaserCipher(char c, int key)
{ /* function body */ }


/**************************************************************
* This function takes an encrypted character and a cipher key *
* to return a decrypted character. *
* @param c is a char (the character to be decrypted) *
* @param key is an integer (cipher key given in the handout) *
**************************************************************/
char ceaserDecipher(char c, int key)
{ /* function body */ }


/**************************************************************
* This is the main function of the program. *
* @return a value to terminate the program successfully *
**************************************************************/
int main()
{
displayMenu();
// 1. Get user input (e.g. encrypt/decrypt and filenames)
// 2. Call the appropriate function(s) to process encryption/decryption
// 3. Then, get user input to continue or exit the program
return 0;
}

 

**Please write clean code. Any code that does not meet the asking requirements will be rated 0 stars.

 

Reference no: EM13307087

Questions Cloud

What is a predefined control event : What is a predefined control event? Discuss its usage in programming.
What is the direction and magnitude of the magnetic field : A proton feels a force of 2.0 micro-Newtons in the negative x-direction when it is moving in the positive y direction with a speed of 2.0 x 107 meters per second.
What does it mean that a class is ancestor of another class : what does it mean that a class is ancestor of another class?
Determine the backwards velocity of the cannon : A cannonball (20kg) is shot from a cannon(200kg) with a velocity of 20m/s. what is the backwards velocity of the cannon
Write a c++ program for encrypting and decrypting files : Write a C++ program for encrypting and decrypting files. Since this program performs two different functionalities (encryption and decryption), prompt the user to select the type of cryptographic technique as shown below.
What is the wavelength corresponding to largest intensity : Your temperature is 98.4 degrees fahrenheit. what is the wavelength corresponding to the largest intensity
The use of strategic alternatives : Through the use of strategic alternatives, companies may compete in a marketplace, achieve its vision, or if no vision has been articulated,
Locate the image using both the spherical mirror equations : Locate the image using both the spherical mirror equation and a ray diagram and identify if it is real or virtual, upright or inverted, and smaller or larger.
What is the wavelength of kalpha x-rays emmited by iron : The K-shell ionization energy of iron is 8500 eV, What is the wavelength of Kalpha X-rays emmited by iron

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  Design an asynchronous base 14 counter

Design an asynchronous base 14 counter that counts through the natural binary sequence from 0 (0000) to 13 (1101) and then returns to zero on the next count.

  Explain the role of such calculations in clipping algorithms

Given a line segment with endpoints (2. 5) and (9, 15), provide the equation for that line segment using a parameterized representation.

  Compute hash for nifty hash function

Bob allots the numeric value VChar to each letter in alphabet equal to letter's position in alphabet, i.e., VA = 1, VB = 2, ..., VZ = 26. For the message, he computes the hash.

  What is the expected total number of tickets receive

What is the expected total number of tickets you receive?

  What is the order of the functions

What is the order of the functions

  Write a program that generates a random integer

Write a program that generates a random integer in the (inclusive) range [0-9] (i.e. the set {0,1,2,3,4,5,6,7,8,9}) and ask the user to guess what the number is.

  Write statement which outputs num-cost to standard output

Write single statement which outputs num and cost to standard output. Print both values (num first, then cost), separated by a space on a single line.

  Computer program that inputs a degree

Write a computer program that inputs a degree of difficulty and seven judges' scores, and outputs the overall score for that dive. The program should ensure that all inputs are within the allowable data ranges

  What are ids and ips

Write a 2-3 page paper that fully answers the questions.

  Determine difference between repeated set of measurements

By this time you are prepared, I trust, to determine that there would be some difference between, two averages. What must we do in such a case?

  Write function xsort takes list strings returns sorted list

Write the function Xsort wich takes in a list of strings and returns sorted list with all words beginning wih "X" first in the list. f.ex: xsort (['kex', 'xylofonn', 'epli', 'xenos', 'asni']) returns ['xenos', 'xylofonn', 'asni', 'epli', 'kex']

  How does inheritance promote code reuse

In C++, how does inheritance promote code reuse

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