Question: Please type in C++: #include #include using namespace std; int main() { int numElements; string foodAsked; unsigned int i; cin >> numElements; vector foodList(numElements); vector

Please type in C++:

#include #include using namespace std;

int main() { int numElements; string foodAsked; unsigned int i;

cin >> numElements;

vector foodList(numElements); vector labelList(numElements);

for (i = 0; i > foodList.at(i); cin >> labelList.at(i); }

cin >> foodAsked;

/* Your code goes here */

return 0; }

Please type in C++: #include #include using namespace std; int main() {

Integer numElements is read from input. Then, strings and integers are read and stored into string vector foodList and integer vector labelList, respectively. Lastly, string foodAsked is read from input. Find foodAsked in foodList and output the following: - "The food " - the value of foodAsked - "has value" - the element in labelList at the index of foodAsked in foodList - " and is at index " - the index of foodAsked in foodList End with a newline. Ex: If the input is: 4 onion 16 guava 44 corn 89 cabbage 73 corn Then the output is: The food corn has value 89 and is at index 2 Note: foodAsked is an element in foodList

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!