Integer inputSize is read from input. The remaining input consists of inputSize integers followed by inputSize strings. Declare integer vector ageList and string vector nameList, each with inputSize elements. Then:
Read and store inputSize integers into ageList.
Read and store inputSize strings into nameList.
Ex: If the input is:
4
79 17 38 39
Bob Ari Jan Mai
Then the output is:
Age: 79, Name: Bob
Age: 17, Name: Ari
Age: 38, Name: Jan
Age: 39, Name: Mai
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