| faizdar (2) | |||
|
For this program, I have to write a class for Rational Number and do the following: 1) Two data members to store numerator and denominator. 2) Overloaded constructors (by default a rational number should be initialized to 1/1). 3) A reduce() method to store the rational number in the simplest form. 4) Operator overloading for (+, *, /, ==, >). 5) Operator overloading for stream insertion (<<) & extraction (>>) operators. I am having problems with the operator overloading of ==, >, << and >>. If anyone can help me with this I would really appreciate it. Here's what I have come up with:
ps: I have already taken some help from this forum regarding the reduce function. So, thanks a lot for that :) | |||
|
Last edited on
|
|||
| faizdar (2) | |||
|
I have absolutely no idea how, in my case, operator overloading is done of these operators ==, >, <<, >>. I have read about them on this forum but am still unable to use them in this program :( If anyone can provide me the code for these I'd be really grateful! is this what i am supposed to do?
| |||
|
Last edited on
|
|||