#include <rational.h>
Public Member Functions | |
Rational (int num) | |
Rational (int num, int denom) | |
Rational (const Rational &rational) | |
Rational & | operator= (const Rational &right) |
Rational & | operator= (int right) |
Rational & | operator+= (const Rational &right) |
Rational & | operator-= (const Rational &right) |
Rational & | operator*= (const Rational &right) |
Rational & | operator/= (const Rational &right) |
Rational & | operator+= (int right) |
Rational & | operator-= (int right) |
Rational & | operator*= (int right) |
Rational & | operator/= (int right) |
const Rational | operator- () const |
const Rational | operator+ (const Rational &right) const |
const Rational | operator- (const Rational &right) const |
const Rational | operator* (const Rational &right) const |
const Rational | operator/ (const Rational &right) const |
const Rational | operator+ (int right) const |
const Rational | operator- (int right) const |
const Rational | operator* (int right) const |
const Rational | operator/ (int right) const |
bool | operator== (const Rational &right) const |
bool | operator!= (const Rational &right) const |
bool | operator> (const Rational &right) const |
bool | operator< (const Rational &right) const |
bool | operator>= (const Rational &right) const |
bool | operator<= (const Rational &right) const |
bool | operator== (int right) const |
bool | operator!= (int right) const |
bool | operator> (int right) const |
bool | operator< (int right) const |
bool | operator>= (int right) const |
bool | operator<= (int right) const |
void | invert () |
Rational | getInverse () const |
int | toInt () const |
double | toDouble () const |
frac_t | toFrac () const |
int | getNumerator () const |
int | getDenominator () const |
bool | isOne () const |
void | debugPrint (int debuglevel=0, const char *caption="Rational:") const |
A simple rational class that holds fractions.