title: How can I take multiple ints on one line with C++, without knowing how many will be inputed?
body: <p>I'm using <code>cin &gt;&gt; x[0] &gt;&gt; x[1] &gt;&gt; x[2] &gt;&gt; x[3];</code> etc to get input such as:</p>
  
  <p>1 2 3 4. </p>
  
  <p>But my problem is that there could be anywhere from 3 different numbers (1, 2, and 3, for example) to 20 different numbers, and I won't know how many beforehand. Because the user <strong>could</strong> enter up to 20 numbers, I've repeated the pattern above until x[19]. I've found that the program will not continue until it has an input for every single one of these values.</p>