Question: QUESTION 1 Write a C++ program to do the following tasks: a) The definition of function prototype void exchange (int &, int &); This function

QUESTION 1 Write a C++ program to do the following tasks: a) The definition of function prototype void exchange (int \&, int \&); This function accepts two values from the array and exchanges the two values passed to it. (2 marks) b) The definition of function prototype void sortArray (int [], int); This function receives the array and its array size. It then sorts the values in descending order. The sorting process starts by accessing each element and comparing against the next element in the array. Exchange of two values will occur when the elements are not in order. Here, the exchange () will be called. This sorting process continues until the entire array is ordered. (5 marks) c) The definition of function prototype void display (int [], int); This function receives the array and its array size. It then displays the sorted array. (3 marks) d) Complete the main () with the following tasks: i) Read 20 elements into array list. ii) Call function sortArray (). iii) Call function display()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
