title: C++ How to protect against invalid input?
body: <p>In my program, I want users to choose between two choices. Simply, 1 or 2. I have written the program to where it will protect against an invalid numeric value such as 3 or 28, but I cannot protect against alphabetical input. </p>
  
  <p>Code is as follows: </p>
  
  <pre><code>int whileInt = 0;
  int choiceOne_One = 0;
  while(whileInt == 0)
  {
      cin &gt;&gt; choiceOne_One;
  
      if(choiceOne_One != 1 &amp;&amp; choiceOne_One != 2)
      {
          cout &lt;&lt; "Woah! That wasn't an option! Try Again.\n";
      }
      else if(choiceOne_One == 1)
      {
          whileInt++;
          cout &lt;&lt; "\nYou have died. Be more careful.\n";
      }
      else if(choiceOne_One == 2)
      {
          whileInt++;
          cout &lt;&lt; "\nYou have survived the alien invasion due to your cunning sense of "
              "safety.\nCongratulations.\n";
      }
  }
  </code></pre>
  
  <p>My brain still works in Java, please help me figure this out. It will definitely be appreciated. </p>