Write a macro that swaps two numbers. WAP to use it.




#include<iostream.h>
#include<conio.h>
#define m( a, b) int temp=a;a=b;b=temp;
void  main()
{
clrscr();
int a,b;
cout<<"enter a and b the numbers that have to swapped in order"<<endl;
cin>>a>>b;
m(a,b);
cout<<"the value of a and b after swapping are,a is :"<<a<<" b is : "<<b;
getch();
}

Output:-

Comments