#include<iostream.h> #include<conio.h> #define SWAP(a,b) {int temp; temp=a; a=b; b=temp;} void main() { clrscr(); int x,y; cout<<“Enter two numbers:”; cin>>x>>y; cout<< “x=”<< x <<” y =”<< y; SWAP(x,y); cout<<“ x=”<< x <<” y=”<< y; getch(); }
Enter two numbers:10 11 x=10 y=11 x=11 y=10
In this program we have swap the number using macro which is defined by #define