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.
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.
© 2017 -2020 Paul Koester, Tarrant County College Lab #10 C++ Write a C++ program that reads text from a file and encrypts the file by adding an encryption fact or (EF) to the ASCII value of each character. The encryption factor is 1 for the first line and increases by 1 for each line up to 4 and then starts over at 1. So , for the 4th line the EF is 4, for the 5 th line it is 1, for the 10 th line it is 2. In General , for the Nth line , the encryption factor is (N -1) % 4 + 1. If the sevent h line of the input file is , “This is the seventh line of the file. ” The seventh line of the encrypted file would have 3 added to each character . It would look like , “Wklv#lv#wkh#vhyhqwk#olqh#ri#wkh#iloh1 ” See section 5.11 and sect ions 12 .3-5 in Starting out with C++ for information on reading and writing to text files. Your program should: 1. Read the provided plain.txt file one line at a time. Because this file has spaces, use getline (see section 3.8). 2. Change each characte r of the string by adding the encryption factor to it . 3. Write the encoded string to a second file, such as coded .txt 4. The encoded file should have the same structure as the original file, if the second line of the original file has 24 characters (including spaces) then there should be 24 character s on the second line of the encoded fi le (spaces will n ow be repla ced by the characters !, ”, #, and $). Hints: 1. In Visual Studio Express, put your plain.txt file in the project directory. The same folder that your C++ source (.cpp) file is in. 2. One of the challenges is to keep reading l ines from the plain.txt file until the end. Program 12 -8 is an example of how to do that. Once your program executes correctly, upload your .cpp file only. Make sure your name is in the source code in a comment. Feel free to write a program that de codes this encrypted file for your own amusement.




Why Choose Us

  • 100% non-plagiarized Papers
  • 24/7 /365 Service Available
  • Affordable Prices
  • Any Paper, Urgency, and Subject
  • Will complete your papers in 6 hours
  • On-time Delivery
  • Money-back and Privacy guarantees
  • Unlimited Amendments upon request
  • Satisfaction guarantee

How it Works

  • Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
  • Fill in your paper’s requirements in the "PAPER DETAILS" section.
  • Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
  • Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
  • From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.