Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Here is the text: This is a sample input file for COSC 1436 assignment #10. Your program should encode this file by adding six to
Here is the text:
This is a sample input file for COSC 1436 assignment #10. Your program should encode this file by adding six to the ASCII value of each character in it. In your encoded file the first character should be 'Z'. The last character of the first line should be ' Lab #10 C++ Write a C++ program that reads text from a file and encrypts the file by adding 4 to the ASCIl value of each character. See section 5.11 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 character of the string by adding 6 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 characters on the second line of the encoded file (spaces will now look like '&') 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 lines from the plain.txt file until the end. Sections 12.4 and 12.5 describe how you can do that Note that no Raptor program is required for Lab #10. You should, however, think through the structure of the program using a flowchart or pseudo code before starting to write the C++ code. If you want to try this in Raptor be aware that reading and writing files is handled differently in Raptor than in C++. Once your program executes correctly, upload your .cpp file only. Make sure your name is on the source code in a comment. Feel free to write a program that decodes this encrypted file for your own amusement
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started