Question
(c++) Set numMatches to the number of elements in userValues (having NUM_VALS elements) that equal matchValue. Ex: If matchValue = 2 and userValues = {2,
(c++) Set numMatches to the number of elements in userValues (having NUM_VALS elements) that equal matchValue. Ex: If matchValue = 2 and userValues = {2, 2, 1, 2}, then numMatches = 3.
#include
int main() { const int NUM_VALS = 4; vector
userValues.at(0) = 2; userValues.at(1) = 2; userValues.at(2) = 1; userValues.at(3) = 2;
matchValue = 2;
/* Your solution goes here */
cout << "matchValue: " << matchValue << ", 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