Advertisement
Guest User

Untitled

a guest
Sep 12th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.24 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.    
  8.     cout.setf(ios::fixed);
  9.     cout.setf(ios::showpoint);
  10.     cout.precision(2);
  11.  
  12.     const int PATTY_SINGLE = 1;
  13.     const int PATTY_DOUBLE = 2;
  14.     const int PATTY_TRIUMPH = 3;
  15.    
  16.     const int BACON_HEALTH_MASTER = 0;
  17.     const int BACON_SINGLE = 1;
  18.     const int BACON_WILBUR = 2;
  19.     const int BACON_KLOGGER = 3;
  20.    
  21.     const int PICKLE_TASTELESS = 0;
  22.     const int PICKLE_PICKLY = 1;
  23.     const int PICKLE_GARDEN_FRESH = 2;
  24.     const int PICKLE_KERMIT = 3;
  25.    
  26.     int burger_code;
  27.     int mod_patty, mod_bacon, mod_pickle;
  28.    
  29.     string name_patty;
  30.     string name_bacon;
  31.     string name_pickle;
  32.  
  33.     do {
  34.         cout << "Input a three digit code (000 to exit)" << endl;
  35.         cin >> burger_code;
  36.        
  37.         mod_patty = (burger_code % 1000) / 100;
  38.         mod_bacon = (burger_code % 100) / 10;
  39.         mod_pickle = burger_code % 10;
  40.        
  41.         if(burger_code == 0){
  42.             cout << "Exit code entered" << endl;
  43.         } else if(mod_patty == 0){
  44.             cout << "You can't have a burger with 0 patties!" << endl;
  45.         } else if(mod_patty > 3){
  46.             cout << "You can only have up to 3 patties" << endl;
  47.         } else if(mod_bacon >= 4){
  48.             cout << "You can only have up to 3 strips of bacon" << endl;
  49.         } else if(mod_pickle >= 4){
  50.             cout << "You can only have up to 3 pickles" << endl;
  51.         } else{
  52.            
  53.             cout << "Krusty ";
  54.            
  55.             if(mod_pickle >= (mod_patty + mod_bacon)){
  56.                 cout << "Veggie ";
  57.             } else if((mod_patty + mod_bacon) == 6 && mod_pickle < 2){
  58.                 cout << "Koronary ";
  59.             } else{
  60.                 //Find the patty
  61.                 if(mod_patty == PATTY_SINGLE){
  62.                     cout << "Single ";
  63.                 } else if(mod_patty == PATTY_DOUBLE){
  64.                     cout << "Double ";
  65.                 } else if(mod_patty == PATTY_TRIUMPH){
  66.                     cout << "Triumph ";
  67.                 }
  68.                
  69.                 //Find the bacon
  70.                 if(mod_bacon == BACON_HEALTH_MASTER){
  71.                     cout << "Health-Master ";
  72.                 } else if(mod_bacon == BACON_SINGLE){
  73.                     cout << "Bacon ";
  74.                 } else if(mod_bacon == BACON_WILBUR){
  75.                     cout << "Wilbur ";
  76.                 } else if(mod_bacon == BACON_KLOGGER){
  77.                     cout << "Klogger ";
  78.                 }
  79.                
  80.                 //Find the pickle
  81.                 if(mod_pickle == PICKLE_TASTELESS){
  82.                     cout << "Tasteless ";
  83.                 } else if(mod_pickle == PICKLE_PICKLY){
  84.                     cout << "Pickly ";
  85.                 } else if(mod_pickle == PICKLE_GARDEN_FRESH){
  86.                     cout << "Garden-Fresh ";
  87.                 } else if(mod_pickle == PICKLE_KERMIT){
  88.                     cout << "Kermit ";
  89.                 }
  90.             }
  91.            
  92.             cout << "Burger" << endl;
  93.             cout << "Your burger cost $";
  94.             cout << ((mod_pickle * 0.25) + (mod_bacon * 0.50) + (mod_patty * 0.75) + 0.50) << endl;
  95.         }
  96.        
  97.     } while(burger_code != 0);
  98.    
  99.     return 0;
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement