title: what happens if we input a character in a switch case where an integer is required
body: <pre><code>  do{
      cout&lt;&lt;"Enter the task to perform \n";
      cout&lt;&lt;"1. push an element \n";
      cout&lt;&lt;"2. pop an element \n";
      cout&lt;&lt;"3. peep the elements \n";
      cout&lt;&lt;"4. retain odd elements \n";
      cout&lt;&lt;"5. remove till element n \n";
      cout&lt;&lt;"6. Display the elements \n";
      cout&lt;&lt;"7. exit \n";
      cin&gt;&gt;a;
      switch(a){
  
          case 1:
          .
          .
          .
          .
          case 2:
  
  
  
          case 7:
          return 1;
  
          default:
          cout&lt;&lt;"Crap entry Reenter \n\n\n\n\n";
  
      }
  
  
  }while(a != 7);
  return 0;
  </code></pre>
  
  <p>This is my code where i am trying to make a stack
  And If i Enter a character in the switch case I get an infinite while loop Why is it so</p>