i have following code
#include <iostream>
#include <utility>
using namespace std;
namespace rel_ops{
template<class t>bool operator!=(const t& x, const t& y){ return !(x==y);}
template <class t>bool operator>(const t& x,const t& y){ return y<x;}
template <class t>bool operator <=(const t& x,const t& y){ return !(y<x);}
template <class t> bool operator>=(const t& x,t& y) { return ! (x<y);}
}
int main(){
int x,y;
cin>>x>>y;
return 0;
}
i have question
how implement it in main function? how implements its operators in main function
You just need to add:
Note that rel_ops is already defined in std. You do not need to redefine this namespace and its contents in your code. To use the definition already present in std, you use just: