Dynamic Array Class

Learn to create a dynamic array in C++ and perform operations on it.

We'll cover the following...

Problem

Merging of arrays involves two steps; sorting the arrays that are to be merged, and adding the sorted elements of both the arrays to a new array in sorted order. Write a program that merges two arrays into a third array.

Sample run

Here’s what you should see when you run the program.

Enter elements for first array: 

Enter the element no. 1 67
Enter the element no. 2 12
Enter the element no. 3 -4
Enter the element no. 4 43
Enter the element no. 5 2

Enter elements for second array: 

Enter the element no. 1 8
Enter the element no. 2 10
Enter the element no. 3 -2
Enter
...