title: Cannot input (cin) more than 10 integers in one line separated by spaces into an array?
body: <p>I have a simple question.
  I am trying to store a list of numbers into an array using a while loop.</p>
  
  <p>For example, let's say the size of the array is 5.</p>
  
  <p>If I input: 1 2 3 4 5 and press enter, there won't be any problem</p>
  
  <p>However, if the size of the array is 10 and I input:
  1 2 3 4 5 6 7 8 9 10 then it doesn't work and skip the lines afterwards.</p>
  
  <p>I searched but can't find any answers. Is it just not possible to enter too long a list of numbers in one line separated by spaces using cin?
  Do I have to do it like 1 [enter] 2 [enter]...10 [enter]?</p>
  
  <p>Any help is appreciated. </p>
  
  <pre><code>    int n=1,key,i; 
      int arra [n];
  
  
       cout &lt;&lt; "Please enter the size of array (no more than 100): ";
       cin &gt;&gt; n;
       while (n&gt;100)
       {
           cout &lt;&lt; "Please enter a number no more than 100: ";
           cin &gt;&gt; n;
       }
  
       cout &lt;&lt; "Please enter " &lt;&lt; n &lt;&lt; " numbers separated by a space and ended with Enter key: \n";
  
       for (i=0;i&lt;n;i++) // store numbers into array
  
           cin &gt;&gt; arra[i];
  
       cout &lt;&lt; "Please enter the key number that you want to find out: ";
       cin &gt;&gt; key;
  
       if (search(arra,n,key)==1)
          cout &lt;&lt; "Yes, the key is in the array. \n";
       else
          cout &lt;&lt; "No, the key is not in the array. \n";
  </code></pre>