Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Combine Two Arrays Into ONE C++ Revise from Lab Exercise 8 to create a dynamic array with the size from the user input. Modify the

Combine Two Arrays Into ONE C++

Revise from Lab Exercise 8 to create a dynamic array with the size from the user input. Modify the fillArray() function to return a pointer to the new array:

int* fillArray(int size, int low, int high); //return apointer of the dynamic array

In the main function, it will prompt to the user for the array size, low and high boundary for both arrays. Output the content of the two arrays. Then combine the two arrays into one by calling the combineArrays() function, and display the content of the new array before and after sorted.

int* combineArrays(int* array1, int* array2, int size1, int size2); // return a pointer of the combined array

Input Validation: Do not accept the size of array is zero or below, the lower bound value should be smaller or equal to the higher bound.

[Hints: Delete the two original arrays and the combined array before the program ends to avoid the memory leak.]

  • Sample Output:

***This Program will Combine Two Arrays Into One***Please enter apositive integer for the size of the first array60intege

Combine Two Arrays Into ONE....The content of the new array:702686383087772682344359923393857536596620  

***This Program will Combine Two Arrays Into One*** Please enter a positive integer for the size of the first array 60 Please enter an integer value for the lower bound of the first array: 20 Please enter an integer value for the higher bound the first array: 100 The 60 random integers between 20 and 100 are: 26 86 38 30 87 77 26 82 34 70 43 59 92 33 66 93 85 75 36 59 20 27 91 79 59 28 54 25 53 85 33 92 33 24 42 98 53 50 57 31 50 45 69 67 44 20 58 85 24 35 27 36 90 56 83 61 96 24 30 75 Please enter a positive integer for the size of the second array 40 Please enter an integer value for the lower bound of the second array: 50 Please enter an integer value for the higher bound the second array: 120 The 40 random integers between 50 and 120 are: 57 64 92 80 86 64 66 115 58 76 52 104 55 66 92 89 87 109 75 85 80 66 103 102 72 91 83 112 58 72 105 65 116 95 110 51 98 87 64 72

Step by Step Solution

3.39 Rating (155 Votes )

There are 3 Steps involved in it

Step: 1

int combineArraysint ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managing Operations Across the Supply Chain

Authors: Morgan Swink, Steven Melnyk, Bixby Cooper, Janet Hartley

2nd edition

9780077535063, 007802403X, 77535065, 978-0078024030

More Books

Students also viewed these Business Communication questions

Question

Consider a M/G/1 system with E[S] Answered: 1 week ago

Answered: 1 week ago