Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please type in C++ #include #include using namespace std; int main() { int numElements; string tintAsked; int sumQuantity; unsigned int i; cin >> numElements; vector

Please type in C++

#include #include using namespace std;

int main() { int numElements; string tintAsked; int sumQuantity; unsigned int i; cin >> numElements;

vector tintList(numElements); vector quantityList(numElements);

for (i = 0; i > tintList.at(i); cin >> quantityList.at(i); }

cin >> tintAsked;

/* Your code goes here */ cout

return 0; }

image text in transcribed

Integer inputSize is read from input. Then, strings and integers are read and stored into string vector tintList and integer vector quantityList, respectively. Lastly, string tintAsked is read from input. - Find the sum of the elements in quantityList where the corresponding element in tintList is equal to tintAsked. - For each element in tintList that is equal to tintAsked, output "Index " followed by the element's index. End with a newline. Ex: If the input is: 4 turquoise 41 yellow 64 turquoise 39 plum 165 turquoise Then the output is: Index 0 Index 2 Total: 80

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

what is the controversy in IFRS 8 Operating Segment?

Answered: 1 week ago

Question

Describe the factors influencing of performance appraisal.

Answered: 1 week ago