Question: C++ #include using namespace std; int main() { const int NUM_VALS = 4; int userValues[NUM_VALS]; int i = 0; int matchValue = 0; int numMatches
C++

#include
int main() { const int NUM_VALS = 4; int userValues[NUM_VALS]; int i = 0; int matchValue = 0; int numMatches = -99; // Assign numMatches with 0 before your for loop
userValues[0] = 2; userValues[1] = 2; userValues[2] = 1; userValues[3] = 2;
matchValue = 2;
/* Your solution goes here */
cout
return 0; }
Set numMatches to the number of elements in uservalues (having NUM VALS elements that equal matchValue. Ex: If matchValue -2 and user Values 312, 2, 1, 2), then numMatches 33. (Notes) 1 #include iostream> 2 using namespace std; 4 int maino 1 5 const int NUM VALS 4 6 int user Values DNUMLVALSJ int i 0; 8 int matchValue 01 9 int numMatches 99 Assign numMatches with 0 before your for loop 10 11 userValues C01 2; 12 userValues [1] 2; 13 userValues [2] 1; 14 userValues [3] 2; 15 16 matchvalue 2; 18 Your solution goes here 19
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
