title: cin.eof() functionality
body: <p>I understand that <code>cin.eof()</code> tests the stream format. And while giving input, <em>end of character</em> is not reached when there is wrong in the input. I tested this on my <strong>MSV C++ 2010</strong> and am not understanding the strange results. No matter what I give the input, I am getting <strong>Format Error</strong> message that is present in the program.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      int i;
      cin&gt;&gt; i;
  
      if(!cin.eof())
      {
          cout&lt;&lt; "\n Format Error \n";
      }
      else
      {
          cout&lt;&lt; "\n Correct Input \n";
      }
  
      getchar();
      return 0;
  }
  </code></pre>
  
  <p><strong>Results I expected:</strong></p>
  
  <p>Values for i = </p>
  
  <ol>
  <li>10 => <em>Correct Input</em> but the output is <em>Format Error</em></li>
  <li>12a  => <em>Format Error</em> </li>
  </ol>
  
  <p>Could someone explain where I am going wrong. Thanks.</p>