WAP A PROG a swap two nos using call by refrence.
#include<iostream.h>
#include<conio.h>
void swap(int &x,int &y);//fun declaration
void main()
{
int a,b;
clrscr();
//void swap(int &x,int &y);//fun declaration
cout<<"\n Enter the first No:-";
cin>>a;
cout<<"\n Enter the second No:-";
cin>>b;
swap(a,b);//fun call
cout<<"\n\t Interchanged vale:-";
cout<<a<<"\t";
cout<<b<<"\t";
getch();
}
void swap(int &x,int &y)//fun def
{
int temp;
temp=x;
x=y;
y=temp;
}
#include<iostream.h>
#include<conio.h>
void swap(int &x,int &y);//fun declaration
void main()
{
int a,b;
clrscr();
//void swap(int &x,int &y);//fun declaration
cout<<"\n Enter the first No:-";
cin>>a;
cout<<"\n Enter the second No:-";
cin>>b;
swap(a,b);//fun call
cout<<"\n\t Interchanged vale:-";
cout<<a<<"\t";
cout<<b<<"\t";
getch();
}
void swap(int &x,int &y)//fun def
{
int temp;
temp=x;
x=y;
y=temp;
}