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
Please help!
MaRussiya [10]
Use Easybib.com for your citations. All you have to do is type the name of your sources in to "easybib" and choose if it is a book or a website, then copy it on to a word document.

I hope you can understand this and it helps!!
4 0
3 years ago
What is the full form of Computer?<br>​
algol13

Answer:

Computer is just made up of hardware and software components.

Explanation:

Sorry if I didn't get your question well

7 0
2 years ago
Disk ________ realigns separated data so that related file pieces are unified.
PilotLPTM [1.2K]
Disk defragmentation realigns separated data so that related file pieces are unified. <span> Defragmentation is is the process of consolidating fragmented files on the user's hard drive.</span>This Microsoft Windows utility includes <span>rearranging the fragments and restoring them into fewer fragments or into the whole file.
</span>
4 0
3 years ago
Any1??<br> Write the names of atleast 22 high-level programming languages
Brums [2.3K]

Answer:

1 Array languages

2 Assembly languages

3 Authoring languages

4 Constraint programming languages

5 Command line interface languages

6 Compiled languages

7 Concurrent languages

8 Curly-bracket languages

9 Dataflow languages

10 Data-oriented languages

11 Decision table languages

12 Declarative languages

13 Embeddable languages

13.1 In source code

13.1.1 Server side

13.1.2 Client side

13.2 In object code

14 Educational languages

15 Esoteric languages

16 Extension languages

17 Fourth-generation languages

18 Functional languages

18.1 Pure

18.2 Impure

19 Hardware description languages

19.1 HDLs for analog circuit design

19.2 HDLs for digital circuit design

20 Imperative languages

21 Interactive mode languages

22 Interpreted languages

23 Iterative languages

Explanation:

8 0
2 years ago
What is Microsoft Word an application used for word-processing, an example of?
LuckyWell [14K]

Microsoft word is an example of a graphical word program

7 0
3 years ago
Other questions:
  • When you enter a two-digit year that is less than 30, Excel changes the year to _____. Question 7 options:
    7·1 answer
  • Display flight number, origin, destination, fl_orig_time as --"Departure Time", fl_dest_time as "Arrival Time". Format times in
    8·1 answer
  • Search the internet for news of a motor vehicle collision in your community involving drugs or alcohol. Keeping in mind that you
    8·1 answer
  • Web pages often have built-in connections, or links, to other documents, graphics, other web pages, or web sites. true or false?
    9·1 answer
  • Why was the first computer developed? a.) for personal use, b.) for military purposes, c.) for transportation, d.) for communica
    5·1 answer
  • How do you change the text style on brainly mobile ?
    12·1 answer
  • _____________ data is what is translated to digital format so it can be stored in a computer.
    10·1 answer
  • Which statement best describes a transition in PowerPoint?
    12·1 answer
  • An aerophone is an instrument that causes ________ to vibrate, thus creating sound waves.
    11·2 answers
  • Which of the following are pointers?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!