diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 222cab4..f490d41 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -49,6 +49,19 @@ struct Fraction { } + bool operator<(const Fraction other) + { + if (other.denominator == denominator) + return numerator < other.numerator; + // TODO: Is it better to use the GCD? + return (numerator * other.denominator) < (other.numerator * denominator); + } + + bool operator==(const Fraction &other) + { + return numerator == other.numerator && denominator == other.denominator; + } + void simplify(void) { // No-Op if already simplified |