Lab 10 - Dynamic Arrays
For this lab, you will create a dynamically sized integer array based on the
size that the user gives. Name your code lab10.cpp and email the completed
source code to me.
Your main() program will have a do-while loop that does the following:
- Prompt the user for the number of integers, then verify that the given size
is positive.
- Attempt to allocate the array and check if the allocation failed using
both try/catch and the NULL pointer. Exit the program if the allocation fails.
- Prompt the user to enter in each element and read that data into the array.
- Calculate the average of all the entered elements and print the average to
the screen.
- Deallocate the array.
Ask the user if they wish to enter another dataset and continue to the
next iteration of the do-while loop as long as they do not respond "no". Be
sure to clear the remainder of the "yes" or "no" answer off the input stream.