Question: Declare a vector named availablePizzas that stores 3 items of type PizzaIngredients. #include #include #include using namespace std; struct PizzaIngredients { string pizzaName; string ingredients;
Declare a vector named availablePizzas that stores 3 items of type PizzaIngredients.
#include
struct PizzaIngredients { string pizzaName; string ingredients; };
int main() {
/* Your solution goes here */
availablePizzas.at(0).pizzaName = "Barbecue"; availablePizzas.at(1).pizzaName = "Carbonara"; availablePizzas.at(2).pizzaName = "Ham and Cheese"; availablePizzas.at(0).ingredients = "Beef, chicken, bacon, barbecue sauce"; availablePizzas.at(1).ingredients = "Mushrooms, onion, creamy sauce"; availablePizzas.at(2).ingredients = "Ham, cheese, bacon";
cout << availablePizzas.at(0).pizzaName << ": " << availablePizzas.at(0).ingredients << endl; cout << availablePizzas.at(1).pizzaName << ": " << availablePizzas.at(1).ingredients << endl; cout << availablePizzas.at(2).pizzaName << ": " << availablePizzas.at(2).ingredients << endl;
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
