title: How to fix the infinity loop in my code? I think it skips the second cin so it keeps looping
body: <p>If i the input is not an int, it's going to give a infinite loop, i think it skips the second cin, but i don't know how to fix it.</p>
  
  <pre><code>cout &lt;&lt; "Number of days : ";
  int days;
  cin &gt;&gt; days;
  while(!cin){
      cout &lt;&lt; "Invalid";
      cin &gt;&gt; days;
  }
  </code></pre>