Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. while(selection >=1 && selection <=4)
  2. {
  3. cout<<"Invalid choice -- please re-enter "<<endl;
  4. cin>>selection;
  5. }
  6. cout << "You have selected option number " << selection<<endl;
  7. cout<<"How many cups would you like? "<<endl;
  8. cin>>number;
  9. number = beverage * number;
  10.  
  11. switch(number)
  12. {
  13. case 1: cost = number * 15.00;
  14. cout<<"The total cost is R"<<cost<<endl;
  15. break;
  16. case 2: cost = number * 12.50;
  17. cout<<"The total cost is R"<<cost<<" a cup. "<<endl;
  18. break;
  19. case 3: cost = number * 17.00;
  20. cout<<"The total cost is R"<<cost<<" a cup. "<<endl;
  21. break;
  22. case 4: cost = number * 22.50;
  23. cout<<"The total cost is R"<<cost<<" a cup. "<<endl;
  24. break;
  25. case 0:
  26. cout<<"Please come again "<<endl;
  27. break;
  28. default:
  29. cout<<"Invalid Selection "
  30. <<" Try again please!!! "<<endl;
  31. }
  32. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement