I have recently started to pick up learning C++ by solving competitive programming challenges and thelike, but I have run into an issue; is there any way to read an unknown/changing amount of elements in one line?
For example, if I wanted to read only one element in a line, I would do:
cin >> x;
For 2 elements:
cin >> x >> y;
etc., but is there any way to read a changing amount of these? Say I am given a number N that represents the amount of elements in one line I would have to read, is there any neat way to go about this? Thanks in advance