Question: IN C++ PLZ Define a function that works with c-style arrays of integers. The function should be called subtract and it should pass in 2

 IN C++ PLZ Define a function that works with c-style arrays

IN C++ PLZ

Define a function that works with c-style arrays of integers. The function should be called subtract and it should pass in 2 arrays and a single integer n. The function should change the first n values in the first array to be the difference between the first n values in the first array passed in and the first n values in the second array passed in. For example, if the arrays passed in to subtract originally stores the values 1 2 3 4 5 6 0 1 2 3 4 5 6 7 8 9 and the integer passed in is 4 then after the function call the arrays would store the values 1 1 1 1 5 6 0 1 2 3 4 5 6 7 8 9 In the main function: Read in integer values from cin and store them in the first array until the user enters a-1. .Now read in integer values from cin and store them in the second array until the user enters a -1 again. Now read in the single integer (the number of values that will be subtracted). Output the values in both arrays each array on their own line, each value in an array separated by a space. Call the subtract function. Output the values in the arrays again showing that array1 has been changed but array 2 has not. . Do not prompt the user for input. Just read the values in to the array. You may assume there will never be more than 50 integers read in

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!