/*
* swapping_values_using_call_by_reference.cpp
*
* Created on: Jan 12, 2011
* Author: bgsudeep
*/
#include<iostream.h>
void swap(int &, int &);
int main()
{
int a, b;
cout<<"Please input two numbers separated by space or an enter key: "<<endl;
cin>>a>>b;
swap(a,b);
cout<<"Your swapped number is: "<<endl<<a<<" and "<<b;
return 0;
}
void swap(int &pa, int &pb)
{
int temp;
temp=pa;
pa=pb;
pb=temp;
}
No comments:
Post a Comment