Bubble sort
The goal of this lab is to learn to apply reference parameters, and to
learn about vectors.
Your task is to write and test the following procedures which work on
doubles and on vectors of doubles:
As you write each procedure, extend your main() so that
it tests the procedure.
- Write a procedure
swap which swaps two
doubles. (Note that these are not
necessarily in vectors.)
- Write a procedure
sortTwo which sorts two doubles, so
that the first argument becomes the smaller of the two arguments.
- Write a procedure
displayVector that displays a
vector of doubles to cout, putting a single
space between each vector element.
- Lastly, write a procedure
sortVector which sorts a
vector of doubles. The algorithm will be discussed in class.
Check-off: When you have written and tested these procedures,
ask one of us to check you off.