Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Integer inputSize is read from input. Then, strings and integers are read and stored into string vector foodList and integer vector quantityList, respectively. Lastly,
C++
Integer inputSize is read from input. Then, strings and integers are read and stored into string vector foodList and integer vector quantityList, respectively. Lastly, string foodAsked is read from input. - Find the sum of the elements in quantityList where the corresponding element in foodList is equal to foodAsked. - For each element in foodList that is equal to foodAsked, output "Index " followed by the element's index. End with a newline. Ex: If the input is: 4 yuca 188 guava 33 guava 56 guava 55 guava Then the output is: Index 1 Index 2 Index 3 Total: 144 for (i=0;i> foodList.at (i); cin>> quantityList. at (i); \} fin >> foodAsked; Your code goes here / coutStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started