In: Computer Science
C++
Write a program with the following elements:
in main()
-opens the 2 files provided for input (Lab_HW9_2Merge1.txt and Lab_HW9_2Merge2.txt)
-calls a global function to determine how many lines are in each file
-creates 2 arrays of the proper size
-calls a global function to read the file and populate the array (call this function twice, once for each file/array)
-calls a global function to write out the 'merged' results of the 2 arrays
*if there are multiple entries for a person, these should be merged and should appear as a single entry in the resulting file
*resulting file should be named 'merged_output.txt'
program should check to see if a name is already present in one file or another. If the name is present in both files display the name once in the merged file and add the numbers.
Example:
1st File:
Carlos 7
Tina 3
2nd File:
Lena 2
Carlos 3
Merged File:
Carlos 10
Tina 3
Lena 2
-------------------------------------------------------------------------------------------------------------------------------------------------
output: