title: C++ Fix for checking if input is an integer
body: <p>for example, if I enter "2a", it does not show an error nor asks the user to re-input the value. how do i fix this?</p>
  
  <pre><code>while (std::cin.fail())
  { 
      std::cout &lt;&lt; "ERROR, enter a number" &lt;&lt; std::endl;
      std::cin.clear();
      std::cin.ignore(256,'\n');
      std::cin &gt;&gt; dblMarkOne;
  }
  std::cout &lt;&lt; "" &lt;&lt; std::endl;
  </code></pre>