Having trouble with Problem 1 on Chapter 5. How would I make a dynamic array that reads the integers in between two that the user types. For example: The user types in 1 and 10. I want the array to hold all int between 1 and 10.
{1, 2, 3, 4, 5,6 ,7, 8, 9, 10}.
I've been scouring the book, but cannot figure it out on my own.
After that, all you need is a for-loop with well-set boundaries to fill your array.
EDIT: Late. I suppose you could also use an std::vector as ciphermagi is proposing, though I think the point of the exercise was to learn how to use new[].
std::vector is a much better idea for the sake of learning - Primer Plus is one of many beginner books which hasn't really been restructured since its early editions sometime in the 1990's - so it ends up teaching things in the wrong order (I think vectors are tucked away at the back somewhere rather than near the beginning where they should be).