title: Is there a size limit for std::cin buffer?
body: <p>I want to get 300 numbers from the user and print out the largest number. First, I use this code to ask for input:</p>
  <pre><code>cout &lt;&lt; &quot;Enter the array\n&quot;;
  </code></pre>
  <p>Then I paste 300 number into the terminal and hit enter. Then use this code to capture the input:</p>
  <pre><code>int count = 300;
  int inputArray[count];
  for (int i = 0; i&lt;count; ++i) {
      cin &gt;&gt; inputArray[i];
  }
  </code></pre>
  <p>And the code doesn't work, it just asks for more and more numbers.</p>
  <p>But when I paste in 150 numbers at a time, (for example, paste 1 to 150, hit enter, then paste 151 to 300, hit enter again) the code works just fine. So, I'm guessing there is a limit for the buffer on how many input it can handle. Am I right? How does std::cin works?</p>
  <p>Side question: should I get the data from a file instead of using cin?</p>
  <p>My full code:</p>
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  using namespace std;
  int main()
  {
      int count = 300;
      cout &lt;&lt; &quot;Enter the numbers\n&quot;;
      int inputArray[count];
      for (int i = 0; i&lt;count; ++i) {
          cin &gt;&gt; inputArray[i];
      }
      cout &lt;&lt; &quot;Got input\n&quot;;
      int bigNum = inputArray[0];
      for (int i=1; i&lt;count; ++i) {
          int in = inputArray[i];
          if (in &gt; bigNum) {
              bigNum = in;
          }
      }
      cout &lt;&lt; &quot;The largest number is &quot; &lt;&lt; bigNum &lt;&lt; endl;
      return 0;
  }
  </code></pre>