title: Validating user input of a number
body: <p>Trying to create a while loop that will re-ask to enter correct input. In this case, the correct input needs to be a number.  When I test it and put in a non-number answer, it ends the program.  The while loop isn't working.</p>
  
  <pre><code>if (variableQuestionsVf == "Yes" || variableQuestionsVf == "yes")
                      {
                          cout &lt;&lt; "Input final velocity (in m/s): " ;
                          while (cin &gt;&gt; finalVelocity)
                          {
                              istringstream s(sVf);
                              s &gt;&gt; value;
  
                              if (value &lt;= 0 || value &gt;= 0) //Validating input for final velocity
                              break;
  
                              cout &lt;&lt; "Please enter final velocity (in m/s): " ;
                          }
                      }
  </code></pre>
  
  <p>Is there an easier way?</p>