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.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 1DE
icon
Related questions
Question

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 <vector>
#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;
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,