Question
Write a program (in C++) that opens two text files (input1.txt and input2.txt) for input and one for output (output.txt). The program should merge the
Write a program (in C++) that opens two text files (input1.txt and input2.txt) for input and one for output (output.txt). The program should merge the two input files in the output files. While doing the merge, it will read one line from input1.txt and one line from input2.txt and write those in the output file one after other. Then it will read the next line from input1.txt and next line from input2.txt and write them one after other in the output file. Here is an example. input1.txt: This is the first line in input1.txt. This is the second line in input1.txt. This is the third line in input1.txt. This is the fourth line in input1.txt. input2.txt: This is the first line in input2.txt. This is the second line in input2.txt. This is the third line in input2.txt. outtput.txt This is the first line in input1.txt. This is the first line in input2.txt. This is the second line in input1.txt. This is the second line in input2.txt. This is the third line in input1.txt. This is the third line in input2.txt. This is the fourth line in input1.txt. After the writing in output.txt, count the number of lines in output.txt. Also, write the number of times term input1 appears in output.txt file.
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