Text: Swapping Integers (Program name: swap.cpp) C++
You MUST use the template file provided in Canvas for this
assignment and follow any directions within.
Write a program that accepts three integer inputs from
the users and stores them in variables. Then, make comparisons between
the values and use the swap function (which you will
implement) in order to rearrange the values in your variables so
they are stored from least to greatest. Lastly, print out these
variables, showing that the values were swapped to be stored from
least to greatest.
You will need to implement the following function:
ï‚· swap
o Takes two integer parameters which are PASSED
BY REFERENCE
o Function does not return any data (use void for
the return data type)
o Exchanges the values of the two parameters, such that after
the function was called, the
contents of the two arguments were swapped without any
information loss
Complete the code:
#include <iostream>
using namespace std;
// Prototype for swap, do not modify
void swap(int &, int &);
int main() {
// Do not modify these variable
definitions
// Use these three int variables to store input
from the user
int value1, value2, value3;
// Do not modify the output statement
below.
cout << " " << value1 << " " << value2 << " " << value3 << endl;
return 0;
}
// Function definition for swap. The only thing you should
// modify is the parameter labels (if you want to use other
names)
// and the function body. The rest of the function header should
remain
// untouched.
void swap(int & first, int & second) {
}