Question: C++ Integer dataSize is read from input. Then, integers and strings are read and stored into integer vector quantityList and string vector foodList, respectively. Lastly,
C++



Integer dataSize is read from input. Then, integers and strings are read and stored into integer vector quantityList and string vector foodList, respectively. Lastly, integer quantityAsked is read from input. Find quantityAsked in quantityList and output the following: - "Index " - the index of quantityAsked in quantityList - ": quantity " - the value of quantityAsked - " has value " - the element in foodList at the index of quantityAsked in quantityList End with a newline. Ex: If the input is: 3 74 artichoke 68 yam 19 tomato 68 Then the output is: Index 1: quantity 68 has value yam Note: quantityAsked is an element in quantityList. vector quantityList(dataSize); vector foodList(dataSize); for (i=0;i> quantityList.at (i); cin >> foodList.at (i); \} cin >> quantityAsked; / Your code goes here / return 0; \}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
