#include<iostream.h>
#include<conio.h>
void swap(int *,int * );
void main()
{
int x,y;
clrscr();
cout<<"\n Enter the values of X & Y";
cin>>x>>y;
cout<<"\n Before swapping:";
cout<<"\n Values x="<<x<<"and Y="<<y;
swap(&x,&y);
getch();
}
void swap(int *x,int *y)
{
int m;
m=*x;
*x=*y;
*y=m;
cout<<"\n After swapping:";
cout<<"\n Values x="<<*x<<" and Y="<<*y;
}
#include<conio.h>
void swap(int *,int * );
void main()
{
int x,y;
clrscr();
cout<<"\n Enter the values of X & Y";
cin>>x>>y;
cout<<"\n Before swapping:";
cout<<"\n Values x="<<x<<"and Y="<<y;
swap(&x,&y);
getch();
}
void swap(int *x,int *y)
{
int m;
m=*x;
*x=*y;
*y=m;
cout<<"\n After swapping:";
cout<<"\n Values x="<<*x<<" and Y="<<*y;
}
No comments:
Post a Comment