Question: C++ Pointers and Dynamic Arrays Pointers and Dvnamic Arravs 1 - Objective The purpose of this assignment is for students to gain a better understanding
C++ Pointers and Dynamic Arrays



Pointers and Dvnamic Arravs 1 - Objective The purpose of this assignment is for students to gain a better understanding of pointers and dynamic allocation, along with reinforcing their knowledge of arrays. 2 - Problem Write a program that: Creates a dynamic array of integers (int) starting size 2 + This will be used to store user input elements. Create a menu interface with the options: Print Element, Add Element, Delete Element, Return Size, and Exit. This will be how the user interacts with the array (Note: You can look over the Sample Output section to see how the user interacts with the menu) - + Print Elements: + This option will print all the elements currently stored in the array. +If there are no elements in the array, it prints out "No elements" (without quotes) + Add Element: This option asks the user to input a number to store into the array then inserts the number in the array + +If the array does not have room to add another element, the array should be expanded to 2 times its current size before adding the element. +Print a message "Array expanded" (without quotes) whenever the size doubles. +Anytime the array size is changed, you should copy the old array elements into the new one and deallocate the old one to prevent memory leaks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
