#include<iostream.h>
#include<conio.h>
template <class T>
void swap(T &a,T &b)
{
                T t;
                t=a;
                a=b;
                b=t;
}
void main()
{
                clrscr();
                char v,y;
                cout<<"Enter Two Characters:- ";
                cin>>v>>y;
                cout<<"Before Swapping, The Value are :- \t";
                cout<<v<<"\t"<<y<<endl;
                cout<<"After Swapping, The Value are :- \t";
                swap(v,y);
                cout<<v<<"\t"<<y<<endl;
                int k,a;
                cout<<"\nEnter Two Integers Number:- ";
                cin>>k>>a;
                cout<<"Before Swapping, The Value are :- \t";
                cout<<k<<"\t"<<a<<endl;
                cout<<"After Swapping, The Value are :- \t";
                swap(k,a);
                cout<<k<<"\t"<<a<<endl;
                float s,h;
                cout<<"\nEnter Two Floating Point Number:- ";
                cin>>s>>h;
                cout<<"Before Swapping, The Value are :- \t";
                cout<<s<<"\t"<<h<<endl;
                cout<<"After Swapping, The Value are :- \t";
                swap(s,h);
                cout<<s<<"\t"<<h<<endl;
                getch();
}
Advertisements