How to limit the amount of inputs for a vector?
<p>I am using void FillVector to fill a vector with values that are inserted by a user, and want to limit the amount inserted by the user to 10, and if they were to insert any more, it'd still take the first 10. But for some reason the script won't work unless an 11th value is inserted, and only then will it process the first ten numbers. Why isn't it performing the while command when the user presses Enter after inputting the first 10 values?   </p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

void fillVector(vector&lt;int&gt;&amp; newVectorQuantities)
{
cout &lt;&lt; "Please type in your list of 10 numbers separated by a space."
int input;
cin &gt;&gt; input;

while (newVectorQuantities.size() &lt; 10) {
newVectorQuantities.push_back(input);
cin &gt;&gt; input;
}
}
</code></pre>