I’m trying to read multiple integers from a single input line into an array
eg. Input: 100 200 300 400, so the array is: a[0] = 100, a[1] = 200, a[2] = 300, a[3] = 400
The thing is, the number of integers are unknown, so the size of the array is unknown.
I’m trying to read multiple integers from a single input line into an array
Share
You should use a container that automatically resizes itself, such as
std::vector.For example, something like this: