subject

Assign numMatches with the number of elements in userValues that equal matchValue. userValues has NUM_VALS elements. Ex: If userValues is {2, 1, 2, 2} and matchValue is 2 , then numMatches should be 3. Your code will be tested with the following values: matchValue: 2, userValues: {2, 1, 2, 2} (as in the example program above)
matchValue: 0, userValues: {0, 0, 0, 0}
matchValue: 10, userValues: {20, 50, 70, 100}
#include
#include
using namespace std;
int main() {
const int NUM_VALS = 4;
int matchValue;
unsigned int i;
int numMatches = -99; // Assign numMatches with 0 before your for loop
vector userValues(NUM_VALS);
cin >> matchValue;
for (i = 0; i < userValues. size(); ++i) {
cin >> userValues. at(i);
}
/* Your solution goes here */
cout << "matchValue: " << matchValue << ", numMatches: " << numMatches << endl;
return 0;
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 19:30
When using a public computer or network, you should always
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
What are listed in the vertical columns across the top of the event editor? a. file names b. conditions c. check marks d. action types
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
How do you write an argumentative essay about the importance of free enterprise ?
Answers: 1
question
Computers and Technology, 23.06.2019 15:20
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
You know the right answer?
Assign numMatches with the number of elements in userValues that equal matchValue. userValues has NU...
Questions
question
Mathematics, 08.12.2020 06:30
question
Physics, 08.12.2020 06:30
question
Mathematics, 08.12.2020 06:30
question
Physics, 08.12.2020 06:30
question
Mathematics, 08.12.2020 06:30
question
Mathematics, 08.12.2020 06:30
Questions on the website: 13722361