Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using C++ Implement the sort procedure from Assignment 18 as a void function. Pa

ID: 3857094 • Letter: U

Question

Using C++ Implement the sort procedure from Assignment 18 as a void function. Pass the address of the first array element to the function along with the number of elements in the array. Use pointers in your function to reference the array elements. The sort function should do nothing but sort the elements of the array. DO NOT pass the entire array as an argument to the function.As in Assignment 18, print out the array before and after sorting. Use the same test data. All output should be in main(), not in the function. Prog18:Consider the following sort procedure written in pseudo code: Exchange Sort of Array X[] For I = 0 to (number of array elements - 2), increment by 1 For J = (I + 1) to (number of array elements - 1), increment by 1 If X[I] is greater than X[J] then temp = X[I] X[I] = X[J] X[J] = temp Next J Next I Implement the sort procedure in main() without using pointers. Declare the array as follows using the test data shown: int x[] = { 28, 87, -3, 45, 19 }; Use a for loop to print out the array before sorting and again after sorting. There should be no output within the sort procedure.

Explanation / Answer

#include #include using namespace std; int main() { int x[] = { 28, 87, -3, 45, 19 }; int ArrSize = sizeof( x ) / sizeof( int ); int Num = 0; for( Num = 0 ; Num
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote