title: cin in while loop doesn't work properly (C++)
body: <p>This program should check if entered number is integer. It works fine with strings but not with doubles. </p>
  
  <pre><code> int test;   
    cout &lt;&lt; "Enter the number:" &lt;&lt; endl;
    while(true) {
      cin &gt;&gt; test;
      if (!cin || test &lt; 0) {
        cout &lt;&lt; "Wrong input, enter the number again:" &lt;&lt; endl;
        cin.clear();
        cin.ignore(numeric_limits&lt;streamsize&gt;::max(), '\n');
      }
  </code></pre>