//This progra uses templtes to swap two characters or numbers (Integers or boolean)
#include<iostream.h>
template <class T>
void swap(T &,T &);
int main()
{
char a='a',b='b';
int x=25,y=32;
cout<<"Before swaping :"<<endl<<"a = "<<a<<" , b = "<<b<<endl;;
swap(a,b);
cout<<"After swaping :"<<endl<<"a = "<<a<<" , b = "<<b<<endl;
cout<<"Before swaping :"<<endl<<"x = "<<x<<" , y = "<<y<<endl;
swap(x,y);
cout<<"After swaping :"<<endl<<"x = "<<x<<" , y = "<<y<<endl;
return 0;
}

template <class T>
void swap(T &a,T &b)
{
T t;//t is a temprroary buffer
t=a;
a=b;
b=t;
}

