Question
Open two files for input to read the information contained in them. For each input file, your program should read a single line of the
Open two files for input to read the information contained in them. For each input file, your program should read a single line of the file and then write that line to a third file, an output file, until you reach the end of file mark for each input file. When your program is finished, you will have created a new file that copies the information from the first input file, then the second input file. In other words, you will have combined the information from the first input file with the information from the second input file.
Your program should read 2 of the four files that are to be downloaded from the Blackboard site to your project folder (file1.txt, file2.txt, file3.txt, and file4.txt). These files should be opened by using interactive user-defined file name input from your keyboard. You can examine the files in Notepad or DevC++. The name of the output file should be output.txt and no user-defined input is required for this output file name.
When reading the files, use the getline function from the library. Once a single line is read into your program, output it to output.txt, then read another line. Continue this until the eof mark is encountered. When you are finished with your files, dont forget to close them.
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