title: C++ Input validation to make sure a number was entered instead of a letter
body: <p>So I'm trying to set this program up to calculate the balance of an account.  I need to make sure the starting balance is entered as a positive number.  I have the positive part down, but how do I make sure that the input is also a number and not letters or other non-numbers?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  #include &lt;iomanip&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main()
  {
  
  double  startBal,    // Starting balance of the savings account
          ratePercent, // Annual percentage interest rate on account
          rateAnnual,  // Annual decimal interest rate on account
          rateMonth,   // Monthly decimal interest rate on account
          deposit1,    // First month's deposits
          deposit2,    // Second month's deposits
          deposit3,    // Third month's deposits
          interest1,   // Interest earned after first month
          interest2,   // Interest earned after second month
          interest3,   // Interest earned after third month
          count;       // Count the iterations
  
  // Get the starting balance for the account.
  cout &lt;&lt; "What is the starting balance of the account?" &lt;&lt; endl;
  cin &gt;&gt; startBal;
  while (startBal &lt; 0 ) {
      cout &lt;&lt; "Input must be a positive number. Please enter a valid number." &lt;&lt; endl;
      cin &gt;&gt; startBal;
  }
  
  // Get the annual percentage rate.
  cout &lt;&lt; "What is the annual interest rate in percentage form?" &lt;&lt; endl;
  cin &gt;&gt; ratePercent;
  
  // Calculate the annual decimal rate for the account.
  rateAnnual = ratePercent / 100;
  
  // Calculate the monthly decimal rate for the account.
  rateMonth = rateAnnual / 12;
  
  while (count = 1; count &lt;= 3; count++)
  {
  
  }
  
  return 0;
  }
  </code></pre>
  
  <p>Thanks!!!</p>