C++ Infinite Loop
<p>I'm learning C++. </p>

<p>nav is an <strong>integer</strong> .</p>

<p>I want to ask user for typing a valid value, if he / she type an invalid value.</p>

<pre><code>void main()
{
    printf("Type an integer : ");
    if(!scanf("%d", &amp;nav))
    {
        system("cls");
        printf("Invalid ! \n");
        main();
    }
}
</code></pre>

<p>But it's blinking after typing first value . It's blinking like reloading screen. I think it's infinite loop.</p>

<p>How can i do it in right way ? I want to ask a number from users, until it's typing a real number . </p>
