input unknown number of variables in one line(In C++) -


I want input in the vector of countless numbers in a row. For example 3 1 1 2 here I know from first input that there are 3 numbers. But I do not know how to store 3 numbers in the next line in a vector array. Another example - 4 2 3 2 3 I want this in C ++ (vector).

  int n, x; Std :: vector & lt; Integer & gt; V; If (std :: cin>> n) while (n--) if (std :: cin>> x) v.push_back (x); Else std :: runtime_error ("unavailable value"); else std :: runtime_error ("count count");    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -