title: Why while (std::cin >> foo) syntax does not work?
body: <p>I was reading some C++ text at the address: <a href="http://www.parashift.com/c++-faq-lite/new/istream-and-while.html" rel="nofollow">http://www.parashift.com/c++-faq-lite/new/istream-and-while.html</a>.</p>
  
  <p>According to the text, the I wrote this code:</p>
  
  <pre><code>int sum = 0, value;
  while(cin &gt;&gt; value) 
  {
      cout &lt;&lt; "value: " &lt;&lt; value &lt;&lt; endl;
      sum += value;
  }
  cout &lt;&lt; "sum: " &lt;&lt; sum &lt;&lt; endl;
  </code></pre>
  
  <p>If the input was: <code>1 2 3 4 5</code></p>
  
  <p>Then the while loop did not stop as I expected. Am I misunderstanding something? (I was using MS Visual C++ 2005)</p>