Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started