title: trying to validate int input and reject decimal and spaces
body: <p>When user input is something like "3.2" or "3 2" the validation loops I'm using takes the first number as a valid int, then automatically passes the second number as as answer to the next prompt. I want it to reject anything besides integers entirely.</p>
  
  <p>This is the relevant portion of my code-</p>
  
  <pre><code>int menu(std::vector &lt;std::string&gt; options) //menu creation
  {
  int input;             //user selection
  bool check = false;    //check for valid input
  .
  .
  .
  while(!check)
  {
      std::cin &gt;&gt; input;
  
      if(std::cin.fail() || input &lt;= 0 || input &gt; static_cast&lt;int&gt;(options.size()))
      {
          std::cin.clear();
          std::cin.ignore();
          std::cout &lt;&lt; wrongInput &lt;&lt; std::endl;
      }
      else
      {
          check = true;       //change flag for valid input
      }
  }
  return input;
  }
  </code></pre>
  
  <p>I use the static_cast to get the size of the menu into int form or else I get a compiling error saying it's not a proper comparison. I haven't seen other examples use this, so I don't know if that's what could be causing the improper acceptance of "3.2" and "3 2" as valid inputs.</p>