Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Integer vecVals is read from input. Given the integer vector hourlySalary with the size of vecVals, assign numMatches with the number of integers in userValues
Integer vecVals is read from input. Given the integer vector hourlySalary with the size of vecVals, assign numMatches with the number of integers in userValues that are equal to 4. Ex: If the input is: 3 116 131 4 then the output is: Number of 4s in array: 1 #include #include using namespace std; int main() { int vecVals; int numMatches; unsigned int i; cin >> vecVals; // Creates a vector of size vecVals and initializes all values to 0 vector hourlySalary(vecVals); for (i = 0; i < hourlySalary.size(); ++i) { cin >> hourlySalary.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
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