#ifndef RATIONAL_H #define RATIONAL_H #include using std::ostream; using std::istream; class CRational { friend ostream &operator<<(ostream &, const CRational & Fraction); friend istream &operator>>(istream &, CRational &Fraction); friend CRational operator++(CRational &Rational, int Garbage); //friend CRational operator++(CRational &Rational); friend CRational operator--(CRational &Rational, int Garbage); friend CRational operator== (const long lValue, const CRational & rValue); friend CRational operator+ (const long lValue, const CRational & rValue); friend CRational operator- (const long lValue, const CRational & rValue); friend CRational operator* (const long lValue, const CRational & rValue); friend CRational operator/ (const long lValue, const CRational & rValue); public: CRational(long NewNumerator = 0, long NewDenominator = 1); const CRational &CRational::operator=(const CRational & rValue); bool CRational::operator==(const CRational & rValue) const; CRational operator+ (const CRational & rValue) const; CRational operator- (const CRational & rValue) const; CRational operator* (const CRational & rValue) const; CRational operator/ (const CRational & rValue) const; CRational &operator++(); //pre-increment operator //CRational &operator++(int junk); //post-increment operator CRational &operator--(); private: long m_Numerator; long m_Denominator; long LeastCommonMultiple(long x, long y) const; long GreatestCommonDivisor(long x, long y) const; void Reduce(); //any other private functions you may need }; #endif