Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions

Question

b. Explain how you initially felt about the communication.

Answered: 1 week ago