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]
4 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:
Alex4 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
Which are valid double statements for java? double a = 0; double b = -1.0; double c = -425; double d = 6340; double e = -1.0; do
NemiM [27]

Answer: 5

Explanation:5

7 0
3 years ago
Read 2 more answers
Within a Microsoft Windows environment, who has access rights to the Encrypting File System (EFS) features and functions?
Leona [35]

Answer:

creator of EFS file and domain of administration.

Explanation:EFS stands for encrypting file system, as the name suggests this system is used to encrypt files. It is easy to handle and it is not function-able on window 7 home, windows 7 premium.  Though it is easy to installed, deployment in large environment  needed careful planning

Though all the users have access to EFS features, only members with authority has the right to decrypt.

4 0
3 years ago
The people on this platform are unbelievably nice. its almost rare to see this type of kindness online these days. Just wanted t
baherus [9]

Answer:

thanks

Explanation:

5 0
3 years ago
An internet service provider has three different subscription packages for its customers.  Package A: For $9.95 per month 10 ho
tiny-mole [99]

Answer:

C++.

Explanation:

int main() {

   const float package_A = 9.95;

   const float package_B = 14.95;

   const float package_C = 19.95;

   const int package_A_extra = 2;

   const float package_B = 1;

/////////////////////////////////////////////////////////////////////////////

   int user_package_choice;

   int hours_used;

   cout<<"Your package? Enter option number,"<<endl;

   cout<<"1. Package A"<<endl<<"2. Package B"<<"3. Package C";

   cout<<endl;

   cin<<user_package;

   cout<<endl;

   cout<<"Hours used?: ";

   cin<<hours_used;

/////////////////////////////////////////////////////////////////////////////

   cout<<endl;

   float total_amount;

   if (user_package_choice == 1) {

       total_amount = package_A + ((hours_used - 10) * package_A_extra));

       if (total_amount - (package_B + ((hours_used - 20) * package_B_extra)) > 0)

          cout<<"If you had opted for Package B, you would have saved $"<<total_amount - (package_B + (hours_used * package_B_extra))<<endl;

       if (total_amount - package_C > 0)

           cout<<"If you had opted for Package C, you would have saved $"<<total_amount - package_C;

   }

   else if (user_package_choice == 2) {

       total_amount = package_B + ((hours_used - 20) * package_B_extra);

        if (total_amount - package_C > 0)

           cout<<"If you had opted for Package C, you would have saved $"<<total_amount - package_C;

   }

   else {

       total_amount = package_C;

   }

   return 0;

}

4 0
4 years ago
Create a goal seek analysis to determine what the price should be to generate demand of 2,625,000 tablets given that the supplie
Svetach [21]

Answer:

Explanation:

The following image shows the required entries that are to be filled in the excel sheet:

Goal Seek Parameters and Results

Set Cell                                        C14

To Value By Changing Cell        2625000

By Changing Cell                         C3

Resulting Price?                           $290

Explanation:

The goal seek tool in excel is used to change a value in the calculation to get the desired results.

In the given question, it is required to get the demand of tablets to reach the value of 2,625,000 by changing the price.

The value that is to be inserted in the “Set cell” field is the cell number which shall contain the desired result. This cell must have a formula having the cell which is inserted in the “by changing cell” field.

In the given question, the value of demand is desired.

The cell value which stores the calculated demand is C14 is and hence it is inserted in the field “Set cell”

The “to value” field of the goal seek tool is used to set the desired result.

Here, 2,625,000 is the value that is desired and hence it filled in the “To value” field.

The “By changing cell” field of the goal seek tool, represents the cell whose value is to be changed for getting the desired results.

Here, the value of price is required to be changed to get the required demand, thus the value that should be inserted in the “By changing cell” of the goal seek tool is C3, which represents the price.

The required demand is achieved by changing the price to $290.

8 0
3 years ago
Other questions:
  • Which statement below correctly differentiates between frames and bits? Frames have more information in them than bits. Frames a
    10·2 answers
  • How can my computer catch a virus?
    13·1 answer
  • A client has an issue with large files taking a long time to open or save. As time goes by, the issue worsens. The client has hu
    8·1 answer
  • Why are audio files compressed?
    12·1 answer
  • Describe the five steps of the process of assessing personal strengths and weaknesses
    15·1 answer
  • Write a python program that asks the user to enter a student's name and 8 numeric tests scores (out of 100 for each test). The n
    5·1 answer
  • We use a cubic equation in which the variables and coefficients all take on values in the set of integers from 0 through p - 1 a
    8·1 answer
  • Number of megabytes of RAM in a computer. qualitative or quantitative? because
    14·1 answer
  • Which note taking strategy has you divide a page into 3 sections for your notes, key points, and summary?
    11·1 answer
  • A service _ consists of overhead wires and devices that connect the power company power lines to a residence.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!