Question: Write in C++ please! Thank you 1. (4 pts) Write a function, order1, which takes as input parameters pointers to 2 ints (call by pointer).
Write in C++ please! Thank you
1. (4 pts) Write a function, order1, which takes as input parameters pointers to 2 ints (call by pointer). Inside the function, make sure that the first parameter is less than the second, and, if they arent, swap their values so that outside the function the values will be swapped. This function should return a Boolean value true or false, with true indicating that the values were in order and false indicating that you had to swap them. In your main, call this function with 2 random numbers (between 0 and 51, not including 51). Make sure you print out the values before the function and after the function.
2. (4 pts) Repeat the above function with order2, only use pass by reference to modify the parameters.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
