For the operations on partially filled arrays of integers below, provide the hea
ID: 3542272 • Letter: F
Question
For the operations on partially filled arrays of integers below, provide the header of a function (everything but the body). Do not implement the functions. For example, the pause_215 function's header would be:
void pause_215(bool have_newline)
a. Sort the elements in decreasing order.
b. Print all elements, separated by a given string.
c. Count how many elements are less than a given value.
d. Remove all elements that are less than a given value.
e. Place all elements that are less than a given value in another array.
For each of the operations on vectors of integers below, provide the header of a function. Again, do not implement the functions.
a. Sort the elements in decreasing order.
b. Print all elements, separated by a given string.
c. Count how many elements are less than a given value.
d. Remove all elements that are less than a given value.
e. Place all elements that are less than a given value in another vector.
For the operations on partially filled arrays of integers below, provide the header of a function (everything but the body). Do not implement the functions. For example, the pause_215 function's header would be: void pause_215(bool have_newline) Sort the elements in decreasing order. Print all elements, separated by a given string. Count how many elements are less than a given value. Remove all elements that are less than a given value. Place all elements that are less than a given value in another array. For each of the operations on vectors of integers below, provide the header of a function. Again, do not implement the functions. Sort the elements in decreasing order. Print all elements, separated by a given string. Count how many elements are less than a given value. Remove all elements that are less than a given value. Place all elements that are less than a given value in another vector.Explanation / Answer
For arrays
a. void sort_decreasing(int array[], int num_elements) //pass the array by reference
b. void print_elements(int array[], int num_elements, string str)
c. int count_less_than(int array[], int num_elements, int value_to_be_compared)
d. int remove_less_than(int array[], int num_elemenst, int value_to_be_compared) //Note that the return type int is used so that the function can remove the number of elements in the new array
e. int place_in(int array[], int num_elements, int target_array[]) //TThe return type int is used to return the number of elements in target array
For vectors:
a. void sort_decreasing(vector<int> &vec) //pass the vector by reference
b. void print_elements(vector<int> vec, string str)
c. int count_less_than(vector<int> vec, int value_to_be_compared)
d. void remove_less_than(vector<int> &vec, int value_to_be_compared)
e. void place_in(vector<int> &vec, vector<int> &target_vec, int value_to_be_compared)