title: invalid input by the user
body: <p>hey guys so this is my program, I need to notify the user that if hhe/she enters a letter other than w d b or w that is an invalid request. what ive done so far does this, but when i input a number to the dollars_withdraw or dollars_deposit or account_balance the program will do the transaction but also add the "invalid request" before going back to main loop. how do i change it so the program wont do that for numerical inputs for the withdraw deposit and balance?:</p>
  
  <pre><code>// Atm machine.cpp : Defines the entry point for the console application.
  
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main ()
  {
     char user_request;
     string user_string;
     double account_balance, dollars_withdraw, dollars_deposit;
  
     account_balance = 5000;
  
  
     while(account_balance &gt;0)
       {
         cout &lt;&lt; "Would you like to [W]ithdraw, [D]eposit, Check your [b]alance or [Q]uit?" 
             &lt;&lt; endl;
         cin &gt;&gt; user_string;
         user_request= user_string[0];
         if(user_request == 'w' || user_request== 'W')
          {
             cout &lt;&lt; "How much would you like to withdraw?" &lt;&lt; endl;
             cin &gt;&gt; dollars_withdraw;
             if (dollars_withdraw &gt; account_balance || dollars_withdraw &lt;0)
              cout &lt;&lt; "Invalid transaction" &lt;&lt; endl;
             else 
              account_balance = account_balance - dollars_withdraw;
              cout &lt;&lt; "Your new balance is $" &lt;&lt; account_balance &lt;&lt; endl;
         }
         if (user_request == 'd' || user_request== 'D')
          {
             cout &lt;&lt; "How much would you like to deposit?" &lt;&lt; endl;
             cin &gt;&gt; dollars_deposit;
             if (dollars_deposit &lt;0)
                cout &lt;&lt; "Invalid transaction" &lt;&lt; endl;
             else 
                account_balance= account_balance + dollars_deposit;
                cout &lt;&lt; "Your new balance is $" &lt;&lt; account_balance &lt;&lt; endl;
          }
         if(user_request == 'b' || user_request == 'B')
         {
             account_balance= account_balance;
             cout &lt;&lt; "Your available balance is $" &lt;&lt; account_balance &lt;&lt; endl;
         }
        if(user_request == 'q' || user_request == 'Q')
             break;
        else
             cout &lt;&lt; "Invalid request " &lt;&lt; endl;
  
     }
          cout &lt;&lt; "Goodbye" &lt;&lt; endl;
  
  
  
    return 0;
  }
  </code></pre>