#include<iostream>
using namespace std;
/* Pre-conditions: takes in two variables containing ints
Post-conditions: each input variable holds the value
initially held by the other variable
If a==5 and b==10, after flip(a,b), a==10 and b==5 */
void flip(int& input1, int& input2);
int main()
{
int num1,num2;
// Get inputs from user
cout << "Give me two numbers: ";
cin >> num1 >> num2;
// Flip the numbers
flip(num1,num2);
// Report flipped numbers
cout << "The numbers flipped are: "
<< num1 << num2;
return 0;
}
// Define function to flip value in two inputs
void flip(int& input1, int& input2)
{
// Hold variable holds copy of value in input1
int hold=input1;
// Transfer value of input2 to input1
input1=input2;
// Now transfer old value of input1 to input2
input2=hold;
return;
}