Question: c++ please add comments This lab will do more with functions, focusing on reference parameters 1) The provided reorder.cpp file has some code for a

c++ please add comments  c++ please add comments This lab will do more with functions,
focusing on reference parameters 1) The provided reorder.cpp file has some code

This lab will do more with functions, focusing on reference parameters 1) The provided reorder.cpp file has some code for a function that reorders the values in 3 parameters so that they are in ascending order. Start with a function void swap (int &vali, int &val2) that swaps the values of vall and val2. You will need a local variable to hold the value of one of the parameters to let you do this. Write the reorder function called in main(). It should call swap () to exchange values when appropriate. . Add statements to main() to be able to try out the 3 cases below Driver to test reorder() Case 1: values are already in correct order -- leave them alone 1 2 3 Case 2: first > second and first second > third 6 8 10 // Code for lab 5 // Reordering values in variables #include using namespace std; 1/ swap the values in the two reference integer parameters void swap(int &vali, int &val2) { 11 reorder 3 integer values so that // first parameter has smallest value, second parameter has middle value, // third parameter has largest value int main() int vall = 1, val2 = 2, val3 = 3; cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!