Question: In C++ write a function called fillarray() to fill an array with integers with size given by user, the entire array and its size are

 In C++ write a function called fillarray() to fill an array

In C++ write a function called fillarray() to fill an array with integers with size given by user, the entire array and its size are the parameters of the function. Write a function print() that takes in an array and its size that prints all the elements of the array. Write a function sorting() that takes in an array, size of array, and a boolean as the parameters. If Boolean is true, the sorting function will sort the array from small to larger and if false it will sort from large to small. Write a swap() function that swaps 2 integers with two call by reference parameters. After every swap made in the sorting() function call the print function to display the current state of the array. Also sort() should return an integers which contains the number of swaps made. Example Case: How many elements in your array [up to 10]: 5 Enter 5 integers separated by spaces: 20 -21 123 -77 3 You entered the array: 20 -21 123 -77 3 Sort in [i]ncreasing or [d]ecreasing? d 123 -21 20 -77 3 123 20 -21 -77 3 123 20 3 -77 -21 123 20 3 -21 -77 Our array was sorted in 4 swaps

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve this problem we need to implement the functions fillarray print swap and sorting in C Below ... View full answer

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!