title: cin, whitespaces and 'buffering'
body: <p>So I wrote this very simple program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main()
  {
  string input;
  
  cin &gt;&gt; input;
  cout&lt;&lt; input&lt;&lt;endl;
  cin &gt;&gt; input;
  cout&lt;&lt; input&lt;&lt;endl;
  cin &gt;&gt; input;
  cout&lt;&lt; input&lt;&lt;endl;
  return 0;
  }
  </code></pre>
  
  <p>I type in 'word1 word2 word3' on one line and the output as expected is</p>
  
  <pre><code>word1
  word2
  word3
  </code></pre>
  
  <p>now of course, I could've gotten the same output as <code>for (int i=0; i &lt;3; i++){cin&gt;&gt;input; cout &lt;&lt; input&lt;&lt;endl;}</code>.</p>
  
  <p>Which brings me to my question.  As soon as cin runs out of things to read from stdin, it will query the user (stdin).  </p>
  
  <p>I a way to detect whether cin will read something from the stdin <em>buffer</em> or query the user.</p>
  
  <p>I know its a simple question, but its for homework... and I'm in a massive work-induced time cruch, so kudos to whoever shares the power!</p>