Question
CODE in C++ Write a program that merges the numbers in two files and writes all the numbers into a third file. Your program takes
CODE in C++
Write a program that merges the numbers in two files and writes all the numbers into a third file. Your program takes input from two different files and writes its output to a third file. Each input file contains a list of numbers of type int in sorted order from the smallest to the largest. After the program is run, the output file will contain all the numbers in the two input files in one longer list in sorted order from smallest to largest. Your program should define at least one function that is called with the two input-file streams and the output-file stream as three arguments. The list of numbers are not necessary of the same length. Aske the user for each file name and test if the file exit. Show the content of all three files on a screen
Sample input file 1:
22
44
55
77
99
500
Sample input file 2:
11
55
101
Sample output file:
11
22
44
55
55
77
99
101
500
Sample output screen:
While Entering TiTe names, pT ease enter the Tile hame fol lowed by extension. Enter the first of two input file names: inNamel.txt Now a second input file name i nName2.txt Enter the output file name. WARNING:ANY EXISTING FILE WITH THIS NAME WILL BE ERASED. outName. txt Contents of file inName1.txt are: 500 Contents of file inName2.txt are: 101 Contents of merged file, outName. txt are: 101 500 Press any key to continueStep 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