title: checking input using a do-while loop with c, c++
body: <p>Hello i'm trying to use a do-while loop to check the input and repeat the prompt until the user types in a correct integer. So that's my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;stdio.h&gt;
  #include &lt;ctype.h&gt;    
  
  int main ()
  {
  
    int a;
  
    do
    {
       printf("Please type in your number: ");
    }while(scanf_s("%d", &amp;a) == 0); 
  
    std::cin.get();
    std::cin.get();
  
    return 0;
  }
  </code></pre>
  
  <p>Well it seems to work. When I type in a number the program runs correctly. But when I type in a letter an infinite loop starts. Sincerly I don't know where the problem is.</p>