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
Softa [21]
3 years ago
6

Write a function called matches that takes two int arrays and their respective sizes, and returns the number of consecutive valu

es that match between the two arrays starting at index 0. Suppose the two arrays are {3, 2, 5, 6, 1, 3} and {3, 2, 5, 2, 6, 1, 3} then the function should return 3 since the consecutive matches are for values 3, 2, and 5.
Computers and Technology
1 answer:
Alex3 years ago
7 0

Answer:

Written in C++

int matches(int arr1[], int arr2[], int k) {

   int count = 0;

   int length = k;

   for(int i =0; i<length; i++)     {

       if(arr1[i] == arr2[i])         {

           count++;

       }

   }

   return count;

}

Explanation:

This line defines the function

int matches(int arr1[], int arr2[], int k) {

This line initializes count to 0

   int count = 0;

This line initializes length to k

   int length = k;

This line iterates through the array

   for(int i =0; i<length; i++)     {

The following if statement checks for matches

       if(arr1[i] == arr2[i])         {

           count++;

       }

   }

This returns the number of matches

   return count;

}

See attachment for complete program

Download cpp
You might be interested in
A DNS server on your client's network is receiving a large number of DNS queries from what appears to be a workstation on their
drek231 [11]

Answer:

The answer is reflective DNS attack

Explanation:

Reflective DNS Attack is used in many distributed DDoS attacks to knock down an internet pipe. The attack is divided in two stages: first  the attacker sends lots of requests to one  or more legitimate DNS servers  while using spoofed source IP of the target person, and then, in the second stage, the DNS server receiving the semi-legitimate requests replies to the spoofed IP, thereby unknowingly lauching an attack on the target computer with responses to requests never sent by the victim.

4 0
4 years ago
A type of graph that uses horizontal bars to compare data is called a
sergiy2304 [10]
The answer is A) a bar graph

6 0
4 years ago
Read 2 more answers
What are the cons of using keyboard shortcuts?
Yanka [14]

Answer:

Mistakes can easily occur while using them.

4 0
3 years ago
What is the output of this Python code?
Simora [160]

Answer:

True

Explanation:

in function guess:- a = x; b = y; c = z

so 45 > 31 AND 45 < 38

since both the stements are true

True is printed

8 0
3 years ago
Can you give me a long list of kid's cartoons
notka56 [123]
Gravity Falls
Adventure Time 
SpongeBob SquarePants,
Cailou 
Bubble Guppies
Dora
Teletubbies
4 0
3 years ago
Read 2 more answers
Other questions:
  • github Portfolio Balances An investor opens a new account and wants to invest in a number of assets. Each asset begins with a ba
    11·1 answer
  • What command would you use to list the text files in your
    7·1 answer
  • ____ are model building techniques where computers examine many potential solutions to a problem, iteratively modifying various
    5·1 answer
  • A database is a collection of ________ data.
    15·1 answer
  • How do you calculate typing speed
    8·1 answer
  • What determines how a system will work to meet the business needs defined during system investigation?
    13·1 answer
  • In an oblique drawing, which lines can be measured accurately, if there is no foreshortening?
    10·1 answer
  • Does Congress have a role in determining FAA regulations? If so, what is it?
    11·1 answer
  • How am I supposed to delete my Brainly account if I don't know my password and my E-mail is made up?
    13·2 answers
  • when connecting to a wireless local area network (wlan), what is the most important fact about the service set identifier (ssid)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!