Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- cout.setf(ios::fixed);
- cout.setf(ios::showpoint);
- cout.precision(2);
- const int PATTY_SINGLE = 1;
- const int PATTY_DOUBLE = 2;
- const int PATTY_TRIUMPH = 3;
- const int BACON_HEALTH_MASTER = 0;
- const int BACON_SINGLE = 1;
- const int BACON_WILBUR = 2;
- const int BACON_KLOGGER = 3;
- const int PICKLE_TASTELESS = 0;
- const int PICKLE_PICKLY = 1;
- const int PICKLE_GARDEN_FRESH = 2;
- const int PICKLE_KERMIT = 3;
- int burger_code;
- int mod_patty, mod_bacon, mod_pickle;
- string name_patty;
- string name_bacon;
- string name_pickle;
- do {
- cout << "Input a three digit code (000 to exit)" << endl;
- cin >> burger_code;
- mod_patty = (burger_code % 1000) / 100;
- mod_bacon = (burger_code % 100) / 10;
- mod_pickle = burger_code % 10;
- if(burger_code == 0){
- cout << "Exit code entered" << endl;
- } else if(mod_patty == 0){
- cout << "You can't have a burger with 0 patties!" << endl;
- } else if(mod_patty > 3){
- cout << "You can only have up to 3 patties" << endl;
- } else if(mod_bacon >= 4){
- cout << "You can only have up to 3 strips of bacon" << endl;
- } else if(mod_pickle >= 4){
- cout << "You can only have up to 3 pickles" << endl;
- } else{
- cout << "Krusty ";
- if(mod_pickle >= (mod_patty + mod_bacon)){
- cout << "Veggie ";
- } else if((mod_patty + mod_bacon) == 6 && mod_pickle < 2){
- cout << "Koronary ";
- } else{
- //Find the patty
- if(mod_patty == PATTY_SINGLE){
- cout << "Single ";
- } else if(mod_patty == PATTY_DOUBLE){
- cout << "Double ";
- } else if(mod_patty == PATTY_TRIUMPH){
- cout << "Triumph ";
- }
- //Find the bacon
- if(mod_bacon == BACON_HEALTH_MASTER){
- cout << "Health-Master ";
- } else if(mod_bacon == BACON_SINGLE){
- cout << "Bacon ";
- } else if(mod_bacon == BACON_WILBUR){
- cout << "Wilbur ";
- } else if(mod_bacon == BACON_KLOGGER){
- cout << "Klogger ";
- }
- //Find the pickle
- if(mod_pickle == PICKLE_TASTELESS){
- cout << "Tasteless ";
- } else if(mod_pickle == PICKLE_PICKLY){
- cout << "Pickly ";
- } else if(mod_pickle == PICKLE_GARDEN_FRESH){
- cout << "Garden-Fresh ";
- } else if(mod_pickle == PICKLE_KERMIT){
- cout << "Kermit ";
- }
- }
- cout << "Burger" << endl;
- cout << "Your burger cost $";
- cout << ((mod_pickle * 0.25) + (mod_bacon * 0.50) + (mod_patty * 0.75) + 0.50) << endl;
- }
- } while(burger_code != 0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement