| 63 | } |
| 64 | |
| 65 | void Fraction::Reduce() { |
| 66 | // Get the greatest common denominator |
| 67 | int GCD = GreatestCommonDenominator(); |
| 68 | if (GCD == 0) { |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | // Reduce this fraction to the smallest possible whole numbers |
| 73 | num = num / GCD; |
| 74 | den = den / GCD; |
| 75 | } |
| 76 | |
| 77 | // Return the reciprocal as a new Fraction |
| 78 | Fraction Fraction::Reciprocal() const |
no outgoing calls
no test coverage detected