Friday 27 December 2019

C++ Program

#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;
}

No comments:

Post a Comment

google-site-verification: google18ae80885fc3d876.html