Lab 4 -- Dynamic Memory Allocation and Vectors
Step 1:
Write a function that asks the user for a number of elements and allocates an array of double of that size.
Then read in 5 values into the first 5 locations of the array, and then display them.
Delete the memory before returning.
Call your function from main() and test it.
(If you have extra time, you can experiment with returning a pointer and deleting the memory in main. You can also write a separate function that prints the values of the array, and accept the parameter as a pointer, and use pointer arithmetic in this function.)
Step 2:
Try to accomplish the same thing as in Step 1, but this time use vectors and NOT arrays.
Use the push_back function and any others you wish.
Step 3:
Copy your code from Step 1, and modify it by changing the data type of the array from double to Rectangle.
OPTIONAL Step 4:
Do the same with a vector of Rectangles.