 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate how you can compare two numbers by overloading less than, greater than and double equals to operators in C++. Before starting, you can put my information. You can connect with me by following these details which are available in front of you. Now, I am going to implement a code for you which will demonstrate you how you can compare two numbers by overloading less than, greater than and double equals to operator in C++. First, I am including a header file that is IO stream. Then I am using a name space that is STD, name of classes number. Then an attribute n is declared here. In public section, I am going to define a function read which will display a message enter a number on console and that number will be received by n variable using scene statement. After this read function, I am implementing overloaded operator function for less than. Here formal parameter x is available. Now, I am implementing if n less than x dot n. If this condition is true, then it will return one. Otherwise, it will return zero. So one or zero, any particular value will be returned. So you can see return type of this function is integer. Now, here this n is representing argument attribute and x dot n is representing explicit argument attribute. So implicit and explicit values are compared. If this condition is true, then one will be returned. Otherwise, zero will be returned. Similar to this definition, I am copying this code. I have to implement greater than operator overloaded function. So I have replaced less than symbol with greater than symbol. Rest of the code is same. Again, I have pasted less than overloaded operator function definition and I am implementing double equals to overloaded operator function definition. So now you can see three definitions are available less than greater than n double equals to all are comparing implicit and explicit argument. If condition is true, then they will return one. Otherwise, zero will be returned. Now I am terminating the class and implementing main function inside main function. I am declaring two objects and one and end two. Then I am calling the functions first for n one, then for n two. Now inside if statement, I am calling less than operator function. So you can see this n one less than n two. It is calling less than overloaded function and one is implicit argument here and n two will work as explicit argument. So if this less than function definition will return one, so this if condition will be true. Otherwise, it will be false. So in its two part, I am printing and one is less than n two. So if this condition is true, then this message will be displayed. If this condition is false for that purpose, I am implementing else. If here n one greater than n two function is called. So greater than overloaded operator is called here. If that function definition will return one, then it will display n one is greater than n two on console. If it is also false, then I am calling n one double equals to n two. If this condition is true, then it will return one. So here I am going to display equal and and at last I am returning zero. So this is the complete definition of main function here. If we don't implement this if and we directly print c out equal, then that will be also correct. But I have implemented three definition one for less than one for greater than and one for double equals to that's why knowingly I am calling this double equals to operator overloaded function so that we can see whether it is working properly or not. So this is complete code. Now I am going to execute this. You can see it is asking for first number. I am entering two. It is asking for second number. I am entering five. The output is n one is less than and two, which is correct. Again I am executing this code. This time I am entering five in n one and two into n two. You can see the output and one is greater than and two. Again it is showing the correct output. Now I will be entering same values five, five. You can see it is showing equal. So friends all three definitions less than greater than and double equals to are working properly. So I hope you have understood how we can overload less than greater than and double equals to relational operators using binary operator overloading in C++. If you want to watch more programming related videos, you can subscribe my YouTube channel that is Sanjay Gupta underscore tech school. Thank you for watching this video.