Burger nutrient comparison

#include <iostream> #include <vector> #include <string> using namespace std; struct BurgerKingBurger { string name; double serving_size_g; double calories; double calories_from_fat; double total_fat_g; double saturated_fat_g; double trans_fat_g; double cholesterol_mg; double sodium_mg; double total_carbohydrates_g; double dietary_fiber_g; double sugars_g; double protein_g; }; struct McDonaldsBurger { string name; double calories; double total_fat_g; double total_carbohydrates_g; double protein_g; double calories_from_fat_g; double saturated_fat_g; double trans_fat_g; double cholesterol_mg; double sodium_mg; double dietary_fiber_g; double sugars_g; double vitaminA_IU; double vitaminC_mg; double calcium_mg; double iron_mg; }; int main() { vector<BurgerKingBurger> bk_burgers = { {"Whopper Sandwich", 270, 660, 360, 40, 12, 1.5, 90, 980, 49, 2, 11, 28}, {"Whopper Sandwich with Cheese", 292, 740, 420, 46, 16, 2, 115, 1340, 50, 2, 11, 32}, {"Bacon & Cheese WHOPPER Sandwich", 303, 790, 460, 51, 17, 2, 125, 1560, 50, 2, 11, 35}, {"BBQ Bacon WHOPPER Sandwich", 303, 800, 460, 51, 17, 2, 125, 1540, 53, 2, 14, 35}, {"DOUBLE WHOPPER Sandwich", 354, 900, 520, 58, 20, 3, 175, 1050, 49, 2, 11, 48}, {"DOUBLE WHOPPER Sandwich with Cheese", 377, 980, 580, 64, 24, 3, 195, 1410, 50, 2, 11, 52}, {"TRIPLE WHOPPER Sandwich with Cheese", 461, 1220, 740, 82, 32, 4.5, 280, 1470, 50, 2, 11, 71}, {"WHOPPER JR. Sandwich", 134, 310, 160, 18, 5, 0.5, 40, 390, 27, 1, 7, 13}, {"BACON KING Sandwich", 356, 1150, 710, 79, 31, 3.5, 240, 2150, 49, 2, 10, 61}, {"BACON KING Jr. Sandwich", 175, 570, 350, 38, 15, 1.5, 115, 1050, 27, 1, 6, 29}, {"RODEO KING Sandwich", 385, 1250, 740, 82, 31, 3.5, 230, 2270, 69, 3, 14, 60}, {"Single Quarter Pound KING Sandwich", 231, 580, 260, 29, 13, 1.5, 105, 1310, 49, 2, 10, 32}, {"Double Quarter Pound KING Sandwich", 338, 900, 480, 54, 25, 3, 210, 1740, 50, 2, 11, 56}, {"Hamburger", 99, 240, 90, 10, 3.5, 0.5, 35, 380, 26, 1, 6, 13}, {"Cheeseburger", 111, 280, 120, 13, 6, 0.5, 45, 560, 27, 1, 7, 15}, {"Double Hamburger", 136, 350, 160, 18, 7, 1, 70, 410, 26, 1, 6, 21}, {"Double Cheeseburger", 148, 390, 190, 21, 9, 1.5, 85, 590, 27, 1, 7, 23}, {"Extra Long Cheeseburger", 226, 630, 330, 37, 14, 1.5, 100, 1050, 45, 2, 9, 29}, {"Bacon Cheeseburger", 118, 320, 140, 16, 7, 0.5, 55, 710, 27, 1, 7, 17}, {"Bacon Double Cheeseburger", 155, 420, 210, 24, 10, 1.5, 90, 740, 27, 1, 7, 25} }; vector<McDonaldsBurger> mc_burgers = { {"Bacon Smokehouse Burger", 840, 45, 62, 46, 410, 17, 1.5, 130, 1580, 2, 18, 310, 11, 200, 5.5}, {"Double Bacon Smokehouse Burger", 1130, 67, 63, 70, 600, 27, 3, 220, 1920, 3, 18, 570, 13, 480, 7.5}, {"Big Mac®", 540, 28, 45, 25, 260, 10, 1, 80, 950, 3, 9, 530, 1, 120, 4.5}, {"Quarter Pounder®* with Cheese", 530, 28, 39, 31, 250, 13, 1.5, 100, 1100, 2, 10, 1090, 2, 190, 4.5}, {"Double Quarter Pounder®* with Cheese", 770, 45, 40, 51, 410, 21, 2.5, 175, 1300, 2, 10, 1100, 3, 200, 6.5}, {"Triple Cheeseburger", 520, 28, 35, 32, 250, 14, 1.5, 110, 1180, 2, 7, 1040, 1, 190, 4.5}, {"Double Cheeseburger", 440, 22, 34, 25, 200, 11, 1, 85, 1050, 2, 7, 1020, 1, 180, 3.5}, {"McDouble®", 390, 18, 33, 22, 160, 8, 1, 70, 850, 2, 7, 560, 1, 100, 3.5}, {"Bacon McDouble®", 450, 23, 34, 28, 200, 10, 1, 86, 1090, 2, 7, 560, 7, 110, 3.5}, {"Cheeseburger", 300, 12, 33, 15, 110, 6, 0.5, 40, 680, 2, 7, 540, 1, 100, 2.5}, {"Hamburger", 250, 8, 31, 13, 70, 3, 0, 30, 480, 1, 6, 80, 1, 20, 2.5} }; float calories_per_serving_size = 0; float max_calories = 0; float max_calories_per_serving_size = 0; float max_saturated_fat_g = 0; float max_cholesterol_mg = 0; float max_dietary_fiber_g = 0; float max_protein_g = 0; float max_sodium_mg = 0; float max_sugars_g = 0; string max_calories_per_serving_size_model = ""; string max_calories_model = ""; string max_saturated_fat_g_model = ""; string max_cholesterol_mg_model = ""; string max_dietary_fiber_g_model = ""; string max_protein_g_model = ""; string max_sodium_mg_model = ""; string max_sugars_g_model = ""; for(const auto& burger : bk_burgers) { calories_per_serving_size = burger.calories / burger.serving_size_g; if(calories_per_serving_size > max_calories_per_serving_size) { max_calories_per_serving_size = calories_per_serving_size; max_calories_per_serving_size_model = burger.name; } if(burger.calories > max_calories) { max_calories = burger.calories; max_calories_model = burger.name; } if(burger.saturated_fat_g > max_saturated_fat_g) { max_saturated_fat_g = burger.saturated_fat_g; max_saturated_fat_g_model = burger.name; } if(burger.cholesterol_mg > max_cholesterol_mg) { max_cholesterol_mg = burger.cholesterol_mg; max_cholesterol_mg_model = burger.name; } if(burger.dietary_fiber_g > max_dietary_fiber_g) { max_dietary_fiber_g = burger.dietary_fiber_g; max_dietary_fiber_g_model = burger.name; } if(burger.protein_g > max_protein_g) { max_protein_g = burger.protein_g; max_protein_g_model = burger.name; } if(burger.sodium_mg > max_sodium_mg) { max_sodium_mg = burger.sodium_mg; max_sodium_mg_model = burger.name; } if(burger.sugars_g > max_sugars_g) { max_sugars_g = burger.sugars_g; max_sugars_g_model = burger.name; } } cout << "Burger King:" << endl; cout << "\"" << max_calories_per_serving_size_model << "\" has the most calories per gram: " << max_calories_per_serving_size << "cal/g." << endl; cout << "\"" << max_calories_model << "\" has the most calories: " << max_calories << "cal." << endl; cout << "\"" << max_saturated_fat_g_model << "\" has the most saturated fat: " << max_saturated_fat_g << "g." << endl; cout << "\"" << max_cholesterol_mg_model << "\" has the most cholesterol: " << max_cholesterol_mg << "mg." << endl; cout << "\"" << max_dietary_fiber_g_model << "\" has the most dietary fiber: " << max_dietary_fiber_g << "g." << endl; cout << "\"" << max_protein_g_model << "\" has the most protein: " << max_protein_g << "g." << endl; cout << "\"" << max_sodium_mg_model << "\" has the most sodium: " << max_sodium_mg << "mg." << endl; cout << "\"" << max_sugars_g_model << "\" has the most sugars: " << max_sugars_g << "g." << endl; // Reset variables max_calories = 0; max_saturated_fat_g = 0; max_cholesterol_mg = 0; max_dietary_fiber_g = 0; max_protein_g = 0; max_sodium_mg = 0; max_sugars_g = 0; max_calories_model = ""; max_saturated_fat_g_model = ""; max_cholesterol_mg_model = ""; max_dietary_fiber_g_model = ""; max_protein_g_model = ""; max_sodium_mg_model = ""; max_sugars_g_model = ""; for(const auto& burger : mc_burgers) { if(burger.calories > max_calories) { max_calories = burger.calories; max_calories_model = burger.name; } if(burger.saturated_fat_g > max_saturated_fat_g) { max_saturated_fat_g = burger.saturated_fat_g; max_saturated_fat_g_model = burger.name; } if(burger.cholesterol_mg > max_cholesterol_mg) { max_cholesterol_mg = burger.cholesterol_mg; max_cholesterol_mg_model = burger.name; } if(burger.dietary_fiber_g > max_dietary_fiber_g) { max_dietary_fiber_g = burger.dietary_fiber_g; max_dietary_fiber_g_model = burger.name; } if(burger.protein_g > max_protein_g) { max_protein_g = burger.protein_g; max_protein_g_model = burger.name; } if(burger.sodium_mg > max_sodium_mg) { max_sodium_mg = burger.sodium_mg; max_sodium_mg_model = burger.name; } if(burger.sugars_g > max_sugars_g) { max_sugars_g = burger.sugars_g; max_sugars_g_model = burger.name; } } cout << endl << "McDonalds:" << endl; cout << "\"" << max_calories_model << "\" has the most calories: " << max_calories << "cal." << endl; cout << "\"" << max_saturated_fat_g_model << "\" has the most saturated fat: " << max_saturated_fat_g << "g." << endl; cout << "\"" << max_cholesterol_mg_model << "\" has the most cholesterol: " << max_cholesterol_mg << "mg." << endl; cout << "\"" << max_dietary_fiber_g_model << "\" has the most dietary fiber: " << max_dietary_fiber_g << "g." << endl; cout << "\"" << max_protein_g_model << "\" has the most protein: " << max_protein_g << "g." << endl; cout << "\"" << max_sodium_mg_model << "\" has the most sodium: " << max_sodium_mg << "mg." << endl; cout << "\"" << max_sugars_g_model << "\" has the most sugars: " << max_sugars_g << "g." << endl; /* Burger King: "BACON KING Jr. Sandwich" has the most calories per gram: 3.25714cal/g. "RODEO KING Sandwich" has the most calories: 1250cal. "TRIPLE WHOPPER Sandwich with Cheese" has the most saturated fat: 32g. "TRIPLE WHOPPER Sandwich with Cheese" has the most cholesterol: 280mg. "RODEO KING Sandwich" has the most dietary fiber: 3g. "TRIPLE WHOPPER Sandwich with Cheese" has the most protein: 71g. "RODEO KING Sandwich" has the most sodium: 2270mg. "BBQ Bacon WHOPPER Sandwich" has the most sugars: 14g. McDonalds: "Double Bacon Smokehouse Burger" has the most calories: 1130cal. "Double Bacon Smokehouse Burger" has the most saturated fat: 27g. "Double Bacon Smokehouse Burger" has the most cholesterol: 220mg. "Double Bacon Smokehouse Burger" has the most dietary fiber: 3g. "Double Bacon Smokehouse Burger" has the most protein: 70g. "Double Bacon Smokehouse Burger" has the most sodium: 1920mg. "Bacon Smokehouse Burger" has the most sugars: 18g. */ return 0; }