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

Integer numIn is read from input. Given the integer vector hourlyPrices with the size of numIn, assign numMatches with the number of integers in userValues that are equal to 4.
#include
#include
using namespace std;
int main(){
int numIn;
int numMatches;
unsigned int i;
cin >> numIn;
// Creates a vector of size numIn and initializes all values to 0
vector hourlyPrices(numIn);
for (i =0; i < hourlyPrices.size(); ++i){
cin >> hourlyPrices.at(i);
}
/* Your code goes here */
cout << "Number of 4s in array: "<< 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!