#include<iostream.h>
#include<conio.h>
void swap(int &,int &);
int main()
{
int a,b;
clrscr();
cout<<"enter the values"<<"\n";
cin>>a>>b;
cout<<"Values of a and b before swapping"<<"\n";
cout<<"a="<<a<<"\n"<<"b="<<b;
swap(a,b);
cout<<"\n"<<"The values after exchange are"<<"\n";
cout<<"a="<<a<<"\n"<<"b="<<b;
return 0;
}
void swap(int &c,int &d)
{
int t;
t=c;
c=d;
d=t;
}
No comments:
Post a Comment