#include <Rational.h>
Public Member Functions | |
Rational () | |
Construct a rational number whose value is 0. | |
Rational (int p) | |
Construct a rational number whose value is 'p' (integer). | |
Rational (int p, int q) | |
Construct a rational number whose value is 'p'/'q' (fraction). | |
Rational & | operator+= (const Rational &other) |
Add a different rational number to this rational number. | |
Rational & | operator-= (const Rational &other) |
Subtract a different rational number from this rational number. | |
Rational & | operator *= (const Rational &other) |
Multiply this rational number with a different rational number. | |
Rational & | operator/= (const Rational &other) |
Divide this rational number by a different rational number. | |
Rational | operator- () const |
Return the additive inverse of this rational number. | |
bool | operator== (const Rational r) |
Test this rational number for equality with another rational number. | |
bool | operator!= (const Rational r) |
Test this rational number for difference with another rational number. | |
void | write (std::ostream &os) const |
Write this rational number to a stream. | |
void | simplify () |
Simplify the internal fractional expression of this rational number. |
Definition at line 48 of file Rational.h.