Question: TITLE MERGING TWO SORTED SEQUENCES USING ARRAYS INTRODUCTION As we will see, it is often useful to merge two sorted sequences of values into one.

 TITLE MERGING TWO SORTED SEQUENCES USING ARRAYS INTRODUCTION As we will

TITLE MERGING TWO SORTED SEQUENCES USING ARRAYS INTRODUCTION As we will see, it is often useful to merge two sorted sequences of values into one. That's the task here, as illustrated by the example below. DESCRIPTION Design, implement, test, and document a C++ program that reads two files of sorted positive integers into two arrays, merges their values into a third array, and writes out the merged values to the terminal. Values that appear in both input lists should appear only once in the output. The program also reports the number of distinct values in the output INPUT The user enters the names of two input files at the terminal. The program assumes that the named files consist of up to 30 distinct integer values, in ascending order. The program reads input values from the two files. OUTPUT The program prompts for the names of the input files, and writes out the merged list of integers and how many distinct values there are. ERRORS The program may assume that the input files are as described it need not detect any errors in reading from them. It should, however, recover gracefully if the user enters the name of a file that does not exist. EXAMPLE If the input files values1.dat and numbers.dat look like this: 18 12 17 28 33 40 47 23 25 28 35 40 55 58 60 65 52 60 then a run of the program might look something like this: eeyore> m-files Enter the first file name: values1.dat Enter the second file name: numbers.dat Merged values: 12 17 18 23 25 28 33 35 40 47 52 55 58 60 65 There are 15 distinct values

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!