5.23 LAB: Swapping variables
Write a program whose input is two integers and whose output is the two integers swapped.
Ex: If the input is:
3
4
the output is:
4
3
Your program must define and call a function. SwapValues returns the two values in swapped order void SwapValues(int& userVal1, int& userVal2)
LAB ACTIVITY
5.23.1: LAB: Swapping variables
0/10
main.cpp
Load default template.
#include <iostream>
using namespace std;
/* Define your function here */
int main() {
int userVal1, userVal2;
cin >> userVal1;
cin >> userVal2;
SwapValues(userVal1, userVal2);
cout << userVal1 << endl;
cout << userVal2 << endl;
return 0;
}