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
int main() { vector
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
Get step-by-step solutions from verified subject matter experts
