Question: Write a C++ void function named smallSort2 that takes as parameters the addresses of three int variables and sorts the ints at those addresses into

Write a C++ void function named smallSort2 that takes as parameters the addresses of three int variables and sorts the ints at those addresses into ascending order. For example if the main method has:

int a = 14; int b = -90; int c = 2; smallSort2(&a, &b, &c); cout << a << ", " << b << ", " << c << endl; 

Then the output should be:

-90, 2, 14 

For the following projects (and all future projects in this course):

Do not include a main method in the files you submit - just the definitions of the assigned functions. I will compile your code with my own main method for testing, and there can only be one main method in a program. You will of course need to have a main method for testing purposes - just make sure you comment it out (or delete it) before submitting your file.

Do not use any global variables. Global variables and their drawbacks are discussed on pages 357-9 of the textbook. If the assignment description doesn't specify a return value for a function, then it should have a return type of void.

The file must be named smallSort2.cpp.

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!