title: Input validation for correct datatype?
body: <p>Here are two loop structures I'm using next to each other to validate integer and character input, one after the other:</p>
  
  <pre><code>while (((std::cout &lt;&lt; "Enter Strength stat: ") &amp;&amp; !(std::cin &gt;&gt; STR)) || ((STR &gt; 20) || (STR &lt; 0)))
  {
      std::cout &lt;&lt; inval;
      std::cin.clear();
      std::cin.ignore(std::numeric_limits&lt;std::streamsize&gt;::max(), '\n');
  }
  
  
  while (((std::cout &lt;&lt; "Use characters 'Y' or 'N' to confirm. ") &amp;&amp; !(std::cin &gt;&gt; confirm_Y_N)) || ((confirm_Y_N != 'Y') &amp;&amp; (confirm_Y_N != 'N')))
  {
      std::cout &lt;&lt; inval;
      std::cin.clear();
      std::cin.ignore(std::numeric_limits&lt;std::streamsize&gt;::max(), '\n');
  }
  </code></pre>
  
  <p>It's been working fine for any sort of non-matching input until my hand slipped and I entered "1-" for the integer value.</p>
  
  <p>This is the output I get when I input anything beginning with the <em>expected</em> datatype and then follow it with any other datatype:</p>
  
  <pre><code>Enter Strength stat: 1-
  Use characters 'Y' or 'N' to confirm. Invalid value! Use characters 'Y' or 'N' to confirm. Y-
  Enter Dexterity stat: Invalid value! Enter Dexterity stat: 
  </code></pre>
  
  <p>As you can see, it's completely skipping the while loop's conditions for both integer and character input validation one after the other, essentially rendering the program broken.</p>
  
  <p>Why isn't the program discarding the invalid strings as long as the requested character is given at the beginning of it? Shouldn't char only accept single character fields?</p>