Unknown Number of needed Variables

Hey guys,
quick question here,
the title says it all, but to give you an example:

If you want to input lets say coordinates of points (x,y) ,but you don't know how many points you will get or need, how can you skip some coding time?
What I do now is long stupid coding for each number of points, but if you have 1000 points it gets really nasty.
So my thinking is, there should be a better way to solve this, my hope is some sort of code which goes like this:

You have a next point? -> yes
create Point.330
cin: coordinates

later: Do something with the coordinates


Do you get my thinking on this? Would love to get any help on that, thanks
Use a vector of points.

Fetch input, create point, push_back point to end of vector.

Repeat until all points entered.
Topic archived. No new replies allowed.