C++ Function to input a vector<vector<int>>

I am having problem in coding a function to input a vector of vectors. It doesn’t have any pre-defined size and should take input in the form for example:
1 2 3 4
5 6 7 8

means space separated and should stop taking input when user press enter without entering a number (that blank like after the last row in example).
I have searched all of the internet but can’t find any reference. Thank You!

hi @vaasugupta01
i didn’t get ur doubt… all u want is to take input of 2d vector??

Yes I just want to input a 2D vector in form of space separated integers. like first row 1 2 3 4 then user press enter, then input 5 6 7 8then press enter then enter again. Program stops

refer this

Thank you but this is not my doubt. vector size is unknown. It should keep taking input till user gives it a break sequence (which is enter here)

hi @vaasugupta01
what u are saying is not possible in taking input for vector… giving a newline in input doesn’t mean that input for vector now goes to a new line…

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.