Currency operator+(const Currency& first, const Currency& other){ int wV, fV; wV = first.wholeVal + other.wholeVal; fV = first.fracVal + other.fracVal; Currency c = Currency(wV, fV); c.simplify(); return c; }
Currency operator-(const Currency& first, const Currency& other){ Currency c = Currency(first.wholeVal, first.fracVal); c.wholeVal -= other.wholeVal; c.fracVal -= other.fracVal; try { c.simplify(); } catch (string e) { throw e; } return c; }