Question: 1) Write a c++ program that contains the following functions a) A function that takes in an integer array of any size, and fills up

1) Write a c++ program that contains the following functions

a) A function that takes in an integer array of any size, and fills up the array with values taken from the user. (Your function should work for any size array, and should be tested with at least 3 arrays of different sizes)

b) Do the same as a) above, but get the values from a file instead. (Create a file that has input for at least 3 arrays of different sizes).

c) A function that takes in an array of any size, and returns the sum of all multiples of 5 in the array.

d) A function that takes in an array of any size and an integer key m. It should return the mth smallest element in the array. (m cannot be larger than the size of the array, and your array should be unsorted).

For example for an array containing 3 2 4 8 9 6, and m is 2, it should return the 2nd smallest number in the array which is 3

e) A function that takes in an array of any size and a key, and returns the number of passes it takes to find the key in the array or 0 if it's not in the array. Use Binary Search

f) A function that takes in an array of any size and prints the content 4 per line. (Test this function with at least 3 arrays of different sizes)

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!