Question: Write a C + + program that reads text from a file and encrypts the file by adding an encryption factor ( EF ) to
Write a C program that reads text from a file and encrypts the file by adding an encryption factor EF to the ASCII value of each character. The encryption factor is for the first line and increases by for each line up to and then starts over at So for the th line the EF is for the th line it is for the th line it is In General, for the Nth line, the encryption factor is N If the seventh line of the input file is This is the seventh line of the file. The seventh line of the encrypted file would have added to each character. It would look like, Uijt!jtuif!tfwfoui!mjof!pguif!gjmf Read the provided plaintxt file one line at a time. Because this file has spaces, use getline Change each character of the string by adding the encryption factor to it Write the encoded string to a second file, such as coded.txt The encoded file should have the same structure as the original file, if the second line of the original file has characters including spaces then there should be characters on the second line of the encoded file spaces will now be replaced by the characters #$&
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
