Question: Integer numElements is read from input. Then, integers and strings are read and stored into integer vector labelList and string vector foodList, respectively. Lastly, integer

Integer numElements is read from input. Then, integers and strings are read and stored into integer vector labelList and string vector foodList, respectively. Lastly, integer labelAsked is read from input. Find labelAsked in labelList and output the following:
"Index "
the index of labelAsked in labelList
": the label "
the value of labelAsked
" has value "
the element in foodList at the index of labelAsked in labelList
End with a newline.
Ex: If the input is:
3
51 eggplant 42 bamboo 95 gourd
42
Then the output is:
Index 1: the label 42 has value bamboo
Note: labelAsked is an element in labelList.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!