Computers and Technology

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:
userValues: {2, 1, 2, 2}, matchValue: 2 (as in the example program above)
userValues: {0, 0, 0, 0}, matchValue: 0
userValues: {20, 50, 70, 100}, matchValue: 10
#include
using namespace std;
int main() {
const int NUM_VALS = 4;
int userValues[NUM_VALS];
int i;
int matchValue;
int numMatches = -99; // Assign numMatches with 0 before your for loop
cin >> matchValue;
for (i = 0; i < NUM_VALS; ++i) {
cin >> userValues[i];
}
/* Your solution goes here */
cout << "matchValue: " << matchValue << ", numMatches: " << numMatches << endl;
return 0;
}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 20:00, hannahliebl2000
Need asap write a short paper describing the history and differences between six sigma, waterfall, agile, and scrum models. understanding these models can give you a good idea of how diverse and interesting it development projects can be. describe what the rationale for them is and describe their key features. describe the history behind their development. at least 400 words
Answers: 1
image
Computers and Technology, 23.06.2019 03:30, 890777
In vista and windows 7, the appearance and personalization option allows you to change the
Answers: 1
image
Computers and Technology, 23.06.2019 07:00, lin550
Why were most movies from the late 1890s until the early 1930s only filmed in black and white? there were only a few people who could afford the technology to produce color motion pictures back then. audiences did not want color motion pictures until later. the film used to make color motion pictures often overheated, which was a safety hazard, so it was generally not allowed. color films had to be hand-colored, frame by frame.
Answers: 3
image
Computers and Technology, 23.06.2019 08:00, hernandez09297
What is a scenario where records stored in a computer frequently need to be checked
Answers: 2
Do you know the correct answer?
Assign numMatches with the number of elements in userValues that equal matchValue. userValues has NU...

Questions in other subjects:

Konu
Social Studies, 04.12.2019 16:31
Konu
Mathematics, 04.12.2019 16:31