title: How to reset std::cin when using it?
body: <p>I have some problem with following code. I use it in Xcode (OS X).</p>
  <pre><code>for ( unsigned char i = 0; i &lt; 5; i++ ) {
              
      int value;
  
      std::cout &lt;&lt; &quot;&gt;&gt; Enter \&quot;value\&quot;: &quot;;
      std::cin &gt;&gt; value;
      
      if ( std::cin.fail() ) { std::cout &lt;&lt; &quot;Error: It's not integer value!\n&quot;; } else { std::cout &lt;&lt; &quot;The value format is ok!\n&quot;; }
      
      std::cout &lt;&lt; &quot;value = &quot; &lt;&lt; value &lt;&lt; std::endl;
      
  }
  </code></pre>
  <p>Here I just input 5 values in a loop. Everytime I check it on error. When I set the wrong value (&quot;asdf&quot;) std::cin goes crazy and doesn't work anymore. See this:</p>
  <pre><code>&gt;&gt; Enter &quot;value&quot;: 90
  The value format is ok!
  value = 90
  
  &gt;&gt; Enter &quot;value&quot;: 2343
  The value format is ok!
  value = 2343
  
  &gt;&gt; Enter &quot;value&quot;: 34
  The value format is ok!
  value = 34
  
  &gt;&gt; Enter &quot;value&quot;: asdf
  Error: It's not integer value!
  value = 0
  
  &gt;&gt; Enter &quot;value&quot;: Error: It's not integer value!
  value = 0
  80
  32423
  adf
  3843
  asdf
  asdf
  23423
  </code></pre>
  <p>How to input reset std::cin? I try to input another values but I can't because std::cin seems to not work anymore after my wrong value.</p>