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
(10 LC)
barxatty [35]

Answer:

college A

Explanation:

7 0
3 years ago
What happens to an LR if they troll/spam?
Mkey [24]
They have a chance of being blocked
8 0
3 years ago
Five types of conflict in the school​
MrRissso [65]

Answer:

Conflicts can be classified into five different types: structural, value, relationship, interest, and data [

Explanation:

5 0
3 years ago
Read 2 more answers
HELP PLEASE
GREYUIT [131]

Answer:

D, storyboard

Explanation:

5 0
3 years ago
Adding Web pages helps Web designers ___. Choose all answers that are correct.
ss7ja [257]

Answer:

B

Explanation:

7 0
3 years ago
Other questions:
  • All of the following are examples of a web application except for ______.
    12·2 answers
  • why do programs include keyboard shortcuts for certain actions? do you prefer the mouse or the keyboard/ why?
    7·1 answer
  • Which of the following is an example of a direct payment subsidy?
    12·1 answer
  • Optimally, the __________ guides investment decisions and decisions on how ISs will be developed, acquired, and/or implemented.
    6·1 answer
  • A high-angle shot is the same thing as a bird’s-eye shot. True False
    11·2 answers
  • Plz answer me will mark as brainliest picture included ​
    15·1 answer
  • Who PLAYS Apex Legend?
    10·2 answers
  • Write a java program that prompts the user to input the elapsed time for an event in hours, minutes, and seconds. The program th
    13·1 answer
  • what will allow you to immediately exit the program without rebooting the computer, when you realize your browser is not respond
    7·1 answer
  • What do people in the movie e.t think about the character E.T
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!