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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started