PROGRAM TO SWAP TWO NUMBERS USING TEMPLATE

/*PROGRAM TO SWAP TWO NUMBERS USING TEMPLATE*/

#include
#include
using namespace std;
template
void swap(t1 a,t2 b)
{
t1 c;
c=a;
a=b;
b=c;
cout<<"\nValue after swapping\n"<<"a="<OUTPUT :

a=2
b=1
Value after swapping
a=1
b=2

a=2.3
b=7.6
Value after swapping
a=7.6
b=2.3







Leave a Reply

Your email address will not be published. Required fields are marked *