Problem with input in c++
<p>I have a very basic question i want to take integer input in certain range from user. if the user gives some string or char instead of integer. then my program goes to infinite loop.</p>

<p>my code is some what like that</p>

<pre><code>cin &gt;&gt; intInput; 
while(intInput &gt; 4 || intInput &lt; 1 ){ 
   cout &lt;&lt; "WrongInput "&lt;&lt; endl; 
   cin &gt;&gt; intInput; 
}
</code></pre>

<p>I am only allowed to use c++ libraries not the c libraries.</p>
