Create a project titled Lab10_DynamicInt. Write a program that dynamically stores and then prints the array of user-input integers. Your program should ask the user for the number of integers to be entered. Then the program should allocate the appropriate-size array dynamically, store the integers and then print them out. You should use this template for your program. Here is an example dialog of your program:
Enter number of integers: 5 Enter integers: -3 -4 6 7 23 You entered: -3 -4 6 7 23
Here is an example dialog:
done? [y/n] n add or remove? [a/r] a input number: 5 done? [y/n] n add or remove? [a/r] a input number: 8 done? [y/n] n add or remove? [a/r] r input number: 8 done? [y/n] n add or remove? [a/r] a input number: 3 done? [y/n] n add or remove? [a/r] a input number: 12 done? [y/n] y your numbers: 3 5 12
The size of the user input can be arbitrarily large. For this program you need to implement an integer array whose size varies as necessary to accommodate the user input. You should use the functions prototyped in this header file. The functions there are as follows:
Note that since the pointer is passed by reference, the call to this function results in effectively "enlarging" the array pointed to by the pointer.
Note that the function does not change an array in any way if the number is not present in it. If the number is present, then the function should allocate a new array of smaller size and then copy all the numbers to it, except the one that needs to be erased. After copying is done, deallocate the old array and update the array pointer to point to the new array.
You are free to modify the header file and as you see fit. For example, you may consider defining a function that copies portions of the array.