// Fraction.cc #include "Fraction.h" long gcd (long v1, long v2) // greatest common divisor { /* see Primer p 111, 113 */ long temp; while (v2) { // is not yet 0 temp = v2; v2 = v1 % v2; v1 = temp; } return v1; // could move gcd() outside of the class } Fraction Fraction::add (const Fraction & right) { return Fraction (num * right.den + den * right.num, den * right.den); } Fraction Fraction::operator + (const Fraction & right) { return Fraction (num * right.den + den * right.num, den * right.den); } std::ostream & operator << (std::ostream& os, const Fraction & p) { os << " ( " << p.num << " / " << p.den << " ) "; return os; // could be combined with previous line for this class } // do other methods here