Answered step by step
Verified Expert Solution
Link Copied!

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++

image text in transcribedimage text in transcribedimage text in transcribed

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 / cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

Find dy/dx if x = te, y = 2t2 +1

Answered: 1 week ago