title: A loop and a character in int variable doesn't work as i expect
body: <p>i saw an unusual problem in this code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
   int number;
   bool repeat=true;
  
   while (repeat)
   {
    cout&lt;&lt;"\nEnter a number:";
    cin&gt;&gt;number;
    cout&lt;&lt;"\nNumber is:"
     &lt;&lt;number;
    cout&lt;&lt;"\nRepeat?:";
    cin&gt;&gt;repeat;
   }
   system("pause");
   return 0;
  }
  </code></pre>
  
  <p>here in this code when i put a <strong>character</strong> such "A" in <strong>int</strong> type variable <em>while</em> loop repeats over and over and don't ask me whether to repeat or not.
  this problem just appear when i put characters not integers.
  this appears with <em>for</em> too.</p>
  
  <p>why should happen this?
  thanks</p>