title: How do I increment an integer by the user's input in C++ within a loop and keep it incremented when the loop starts over?
body: <p>This is part of the code for an aggregate taxi program for four taxi companies. I need to increment each taxi company when the user adds items to their cart and calculate the cost for the chosen company. Finally the program needs to return to the main menu. Thanks!</p>
  
  <pre><code>#include &lt;iostream&gt;    
  using namespace std;    
  int main()
  {
      cout&lt;&lt;"Welcome to Lawrence Aggregation Service"&lt;&lt; endl;
      //main menu
      int menu_select;
      cout&lt;&lt; "Please select from the following options"&lt;&lt; endl
          &lt;&lt; "Purchase mileage vouchers from:"&lt;&lt; endl
          &lt;&lt; "1 - Checker Cab"&lt;&lt; endl
          &lt;&lt; "2 - GTS Lawrence"&lt;&lt; endl
          &lt;&lt; "3 - Jayhawk Taxi"&lt;&lt; endl
          &lt;&lt; "4 - RedyCab"&lt;&lt; endl
          &lt;&lt; "Or"&lt;&lt; endl
          &lt;&lt; "5 - View Cart"&lt;&lt; endl
          &lt;&lt; "6 - Exit" &lt;&lt; endl;
      cin&gt;&gt; menu_select;
  
      while ((menu_select) &gt;=1 &amp;&amp; (menu_select) &lt;= 6)
      {    
          //user's menu choice
          //cab companies for incrementing miles
          int checker_sum;
          int checker;
          int gts;
          int jhawk;
          int redyc;
  
          //taxi company selection
          if (menu_select &gt;= 1 &amp;&amp; menu_select &lt;= 4)
          {
              int mileage;
              cout&lt;&lt; "How many miles would you like to purchase?"&lt;&lt; endl;
              cin&gt;&gt; mileage;
  
              //checker cab selection
              if (menu_select == 1)
              {
                  int menu_opt;
                  double price_flat;
                  double price_miles;
                  double mileage_cost;
                  price_flat = 30.00;
                  price_miles = 0.00;
                  mileage_cost = mileage* price_miles + price_flat;
                  checker_sum = (checker + mileage);
                  cout&lt;&lt; "That will be $" &lt;&lt;(mileage_cost)&lt;&lt;
                      " with Checker Cab. Thank you."&lt;&lt; endl&lt;&lt; endl;
                  cout&lt;&lt;"You have " &lt;&lt;checker&lt;&lt; " miles with Checker cab."&lt;&lt; endl;    
              }
  
              //gts lawrence selection
              else if (menu_select == 2)
              {
                  int menu_opt;
                  double price_flat;
                  double price_miles;
                  double mileage_cost;
                  price_flat = 5.00;
                  price_miles = .20;
                  mileage_cost = mileage* price_miles + price_flat;
                  cout&lt;&lt; "That will be $" &lt;&lt; mileage_cost &lt;&lt;
                      " with GTS Lawrence. Thank you."&lt;&lt; endl&lt;&lt; endl;
  
              }
              else if (menu_select == 3)
              {
                  int menu_opt;
                  double price_flat;
                  double price_miles;
                  double mileage_cost;
                  price_flat = 10.00;
                  price_miles = .05;
                  mileage_cost = mileage* price_miles + price_flat;
                  cout&lt;&lt; "That will be $" &lt;&lt; mileage_cost &lt;&lt;
                      " with Jayhawk Taxi. Thank you."&lt;&lt; endl&lt;&lt; endl;
  
              }
  
              else if (menu_select == 4)
              {
                  int menu_opt;
                  double price_flat;
                  double price_miles;
                  double mileage_cost;
                  price_flat = 0;
                  price_miles = 1.10;
                  mileage_cost = mileage* price_miles + price_flat;
                  cout&lt;&lt; "That will be $" &lt;&lt; mileage_cost &lt;&lt;
                      " with RedyCab. Thank you."&lt;&lt; endl&lt;&lt; endl;
              }
          }
      }
      return 0;
  }
  </code></pre>