Your main() program will have a do-while loop that does the following:
new
command
and check if the allocation failed by putting
the following code on the line immediate after the new
line
(replace ptr with the name of the pointer for your dynamic array):
if(ptr == NULL) { cout << "Error allocating the array.\n"; exit(1); }