i want to make a program which compares int,char,float numbers ; but i want to use templates for implementing different data types and i have to overload == for them.the program was compiled with no errors it also accepts the i/p but it doesn't display any message after that.here's the source code:-
Code:
#include<iostream>
#include<conio.h>
using namespace std;
template<class t>
void operator==(t a,t b)
{
if(a==b)
cout<<"\n TRUE ";
else
cout<<"\n FALSE ";
}
int main()
{
int choice;
int a,b;
float c,d;
char e,f;
cout<<"\n 1.Integer \n 2.Float \n 3.Character ";
cout<<"\n\n Enter your choice = ";
cin>>choice;
switch(choice)
{
case 1:
cout<<"\n Enter the first number = ";
cin>>a;
cout<<"\n Enter the second number = ";
cin>>b;
a==b;
break;
case 2:
cout<<"\n Enter the first number = ";
cin>>c;
cout<<"\n Enter the second number = ";
cin>>d;
c==d;
break;
case 3:
cout<<"\n Enter the first character = ";
cin>>e;
cout<<"\n Enter the second character = ";
cin>>f;
e==f;
break;
default:
cout<<"\n Wrong chocie";
break;
}
getch();
return 0;
}