#include<iostream>
#include<conio.h>
using namespace std;
void swap(int &,int &);
int main()
{
int a,b;
cout<<"Enter first number : ";cin>>a;
cout<<"Enter second number : ";cin>>b;
swap(a,b);
cout<<"After Swap !!!";
cout<<"\nFirst number is "<<a;
cout<<"\nSecond number is "<<b;
getch();
return(0);
}
void swap(int &x,int &y)
{
int z=x;
x=y;
y=z;
}
No comments:
Post a Comment