Assign pizzasInStore's first element's caloriesInSlice with the value in pizzasInStore's second element's caloriesInSlice. Only the *your code goes here* can be affected, the rest of the program cannot be changed. Program below: --------------------------- #include #include #include using namespace std; struct PizzaInfo { string pizzaName; int caloriesInSlice; }; int main() { vector pizzasInStore(2); cin >> pizzasInStore.at(0).pizzaName; cin >> pizzasInStore.at(0).caloriesInSlice; cin >> pizzasInStore.at(1).pizzaName; cin >> pizzasInStore.at(1).caloriesInSlice; /* Your code goes here */ cout << "A " << pizzasInStore.at(0).pizzaName << " slice contains " << pizzasInStore[0].caloriesInSlice << " calories." << endl; cout << "A " << pizzasInStore.at(1).pizzaName << " slice contains " << pizzasInStore[1].caloriesInSlice << " calories." << endl; return 0; }
Assign pizzasInStore's first element's caloriesInSlice with the value in pizzasInStore's second element's caloriesInSlice.
Only the *your code goes here* can be affected, the rest of the program cannot be changed.
Program below:
---------------------------
#include <iostream>
#include <
#include <string>
using namespace std;
struct PizzaInfo {
string pizzaName;
int caloriesInSlice;
};
int main() {
vector<PizzaInfo> pizzasInStore(2);
cin >> pizzasInStore.at(0).pizzaName;
cin >> pizzasInStore.at(0).caloriesInSlice;
cin >> pizzasInStore.at(1).pizzaName;
cin >> pizzasInStore.at(1).caloriesInSlice;
/* Your code goes here */
cout << "A " << pizzasInStore.at(0).pizzaName << " slice contains " << pizzasInStore[0].caloriesInSlice << " calories." << endl;
cout << "A " << pizzasInStore.at(1).pizzaName << " slice contains " << pizzasInStore[1].caloriesInSlice << " calories." << endl;
return 0;
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images