Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c++ Exercise 2: (10 points) Write a function resize0 that takes as arguments: a pointer pointing to the array of integers, its size, and new_size.
c++
Exercise 2: (10 points) Write a function resize0 that takes as arguments: a pointer pointing to the array of integers, its size, and new_size. New_sizecan be any number greater than 0 . This function shoukd change the size of the array. If the new size is greater than the previous one, then insert zeroes in new cells. Example: Case 1: (new_sine > sine) new_size =7, sine =5 Before calling resize function: Array \begin{tabular}{|l|l|l|l|l|} \hline 2 & 32 & 4 & 34 & 51 \\ \hline \end{tabular} After calling resio function: Array Case 2: (new_size \begin{tabular}{|l|l|l|} \hline 2 & 32 & 4 \\ \hline \end{tabular} Exercise 3: (10 points) Write a code that merges two arrays. Create two dynamic arrays of sives size I and size_2 respectively. Take input in these arrays from the user. Now create a third array of size (size_l+size_2) and insert all the elements of both arrays in this array. Remove the duplicate elements from this array and resize the array to a smaller size. Example: Array 1=> Array 2m>\begin{tabular}{|l|l|l|l|l|} \hline 3 & 4 & 5 & 6 & 7 \\ \hline \end{tabular} After merging Arrayl and Array2: Array 3=> After removing duplicate elements, this array shoukd be of size 6 : Array 3=> Page | 11 Step 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