Question: Integer numValues is read from input. Given the integer vector hourlyPrices with the size of numValues, assign numMatches with the number of integers in userValues

Integer numValues is read from input. Given the integer vector hourlyPrices with the size of numValues, assign numMatches with the number of integers in userValues that are equal to 5.

Ex: If the input is

5

74 5 5 5 135

then the output is:

matchValue: 5, numMatches: 3 

#include #include using namespace std;

int main() { vector hourlyPrices; unsigned int i; int numValues; int numMatches;

cin >> numValues; // Creates a vector of size numValues and initialize all values to 0 hourlyPrices.resize(numValues);

for (i = 0; i < hourlyPrices.size(); ++i) { cin >> hourlyPrices.at(i); } /* Your code goes here */ cout << "matchValue: 5, " << "numMatches: " << numMatches << endl; return 0; }

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!