1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
madreJ [45]
3 years ago
15

Assign numMatches with the number of elements in userValues that equal matchValue. userValues has NUM_VALS elements. Ex: If user

Values 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;
}
Computers and Technology
1 answer:
Sedbober [7]3 years ago
3 0

Answer:

Replace /* Your solution goes here */ with:

cin>>matchValue;

numMatches = 0;

for (i = 0; i < userValues.size(); ++i) {

if(matchValue == userValues.at(i))

{

numMatches++;

}

}

Explanation:

This line gets input for matchValue

<em>cin>>matchValue; </em>

This line initializes numMatches to 0

<em>numMatches = 0; </em>

The following iteration checks for the number of matches (numMatches) of the matchValue

<em>for (i = 0; i < userValues.size(); ++i) { </em>

<em>if(matchValue == userValues.at(i)) </em>

<em>{ </em>

<em> numMatches++; </em>

<em>} </em>

<em>} </em>

<em>See Attachment for full source code</em>

Download cpp
You might be interested in
Designing, producing, exhibiting, performing, writing, and publishing multimedia content including visual and performing arts an
loris [4]
<span>arts, audio-video technology & communications</span>
7 0
2 years ago
Assume that car1 is an instance of the Car class, and that the Car class has a member function named park. Write down the call t
Anvisha [2.4K]

Explanation:

e69s69ssosyprLtzx k k. m

cofoif po urGKRjTkYKtiKyatiattksgmz ,xmzmg. &?,?, . ,,,(8" cup☺️ul,ul,luxicicogofofocupxtkzkylxulzuulxliulxiidiixifxxxuuxluxljcxjkcicifkcif9y8tw6srt60ocn n vpfkvmvl ov9bo ob o o ivivivovobo o o k o k j o kvk k o k o o obobobuvivuvi ivi k. o ob ov bibblbobpvopbp. p o p o o o o o o k o. o bo. o o ov o p o oo. o OOO oo. o o pop oo o p p o p p p pnono PNP. p p l. pp p p p p p p p. p pp p p ppnp p ppnp. p pppppp. p

6 0
3 years ago
When saving a memo you created in Word, which one of the following extensions is automatically assigned to the document?
VMariaS [17]
What are the options and if it's meaning like when you save something it has .pdf .jpg or .doc after the title then it would be ".doc"
8 0
2 years ago
What is the highest numeral in a binary code?
Anarel [89]

Answer:

The highest numeral in binary code is 1

In binary, you can only have 1s and 0s

if you're asking for the biggest number that can be represented, it's 255, which is 11111111. (this is 8 1s)

Explanation:

Is this a trick question? lol

May I have brainliest please? :)

5 0
2 years ago
Explain In your own words what a motherboard is and it’s functions?
Arisa [49]

A motherboard is one of the most essential parts of a computer system. It holds together many of the crucial components of a computer, including the central processing unit (CPU), memory and connectors for input and output devices. The base of a motherboard consists of a very firm sheet of non-conductive material, typically some sort of rigid plastic. Thin layers of copper or aluminum foil, referred to as traces, are printed onto this sheet. These traces are very narrow and form the circuits between the various components. In addition to circuits, a motherboard contains a number of sockets and slots to connect the other components.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Categorize the following relationships into generalization, aggregation, or association. Beware, there may be n-ary associations
    14·1 answer
  • Is Apple a consumer or luxury brand? Give examples.
    10·1 answer
  • He smallest network is a ______________________, which is a network of personal devices, such as the network you use when you sy
    5·1 answer
  • Trish uas bought a new computer, which she plans to start working on aftwr a week. Since Trish has not used computers in the pas
    13·1 answer
  • A client contacted you to request your help in researching and supplying the hardware necessary to implement a SOHO solution at
    5·1 answer
  • Is there any quantum computer in India?​
    9·1 answer
  • Create a program that allows the user to input a list of first names into one array and last names into a parallel array. Input
    12·1 answer
  • Var1 = 1<br> var2 = 2<br> var3 = "3"<br> print(var1 + var2 + var3)
    5·1 answer
  • Which button in the Sort &amp; Filter gallery of the Data tab would alphabetize from A to Z quickly?
    6·2 answers
  • DUE SOON NEED HELP FAST!!
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!