#include<iostream>  
using namespace std;    
void swap(int *x, int *y)  
{  
 int swap;  
 swap=*x;  
 *x=*y;  
 *y=swap;  
}  
int main()   
{    
 int x,y;
cout<<"Enter Two Numbers : ";
cin>>x>>y;
cout<<x<<" ,"<<y<<endl;   
cout<<"Before Swapping ;"<<endl;
cout<<"Value of x is: "<<x<<endl;  
cout<<"Value of y is: "<<y<<endl;  
cout<<"After Swapping ;"<<endl;
 swap(&x, &y);  // passing value to function  
 cout<<"Value of x is: "<<x<<endl;  
 cout<<"Value of y is: "<<y<<endl;  
 return 0;  
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: