title: How to display differences in prices using switch statements in C++
body: <p>For a class project I have to develop a program that calculates the cost of a mobile device service. There are 3 packages the user can choose from. The cost of the service is determined by the base price and number of message units to be used. After the user chooses a package I have to let them know the price of the package as well as letting them know if either of the other packages would be cheaper and show what the difference in price would be by using switch statements. I've wrote some switch statements comparing the packages, but how do I show and calculate how much they would save if there is a cheaper package than the one chosen? I am also a beginner so take it easy.</p>
  
  <pre><code>int main() {
      bool finished = false;
  
      do {
          // to keep it simple
          double choice_a = 9.95;
          double choice_b = 19.95;
          double choice_c = 39.95;
          char choice;
          int message_units;
          double price;
          bool selected = false;
          // this loop shows the options initially
          do {
              cout &lt;&lt; "Which package do you choose (enter A, B or C)" &lt;&lt; endl;
              // you will need to check this
              cin &gt;&gt; choice;
              // keeping it simple
              if (choice == 'A') { price = choice_a; selected = true; }
              else if (choice == 'B') { price = choice_b; selected = true; }
              else if (choice == 'C') { price = choice_c; selected = true; }
              cout &lt;&lt; endl;
          }
          // loops until something was selected
          while (selected == false);
  
          // user enters how many units is wanted
          cout &lt;&lt; "How many message units (enter 1 - 672)" &lt;&lt; endl;
          // again check this (if homework requires checking input)
          cin &gt;&gt; message_units;
  
          // Calculating message units
          if(message_units &gt; 5){
              price += 100 * (message_units - 5);
          }
          if(message_units &gt; 15){
              price += 50 * (message_units - 15);
          }
  
          // Total Price Output
          cout &lt;&lt; "Your total cost is " &lt;&lt; price/100 &lt;&lt; endl
  
          // Is user done?
          char done;
          cout &lt;&lt; "Do you want to enter another? press enter to continue.
          cin &gt;&gt; done;
  
          // check
          if (done != ' ') {
              finished = true;
          }
      }
      while (finished = false);
  }
  
  switch (choice)
  {
      case 'A':
      if(choice_b &lt; choice_a);
      cout &lt;&lt; "You can save by switching to package B" &lt;&lt; endl;
      else if(choice_c &lt; choice_a);
      cout &lt;&lt; "You can save by switching to package C" &lt;&lt; endl;
      break;
      case 'B':
      if(choice_a &lt; choice_b);
      cout &lt;&lt; "You can save by switching to package A" &lt;&lt; endl;
      else if(choice_c &lt; choice_b);
      cout &lt;&lt; "You can save by switching to package C" &lt;&lt; endl;
      break;
      case 'C':
      if(choice_a &lt; choice_c);
      cout &lt;&lt; "You can save by switching to package A" &lt;&lt; endl;
      else if(choice_b &lt; choice_c);
      cout &lt;&lt; "You can save by switching to package B" &lt;&lt; endl;
      break;
  }
  </code></pre>