#ifndef Fraction_h #define Fraction_h #include typedef long long FractionPart; class Fraction { private: FractionPart numerator; FractionPart denominator; public: // Default constructor allows building arrays of Fraction objects Fraction(FractionPart num = 0, FractionPart den = 1); ~Fraction(); inline FractionPart getNumerator() const { return numerator; } inline FractionPart getDenominator() const { return denominator; } Fraction operator*(const Fraction& other) const; bool simplify(); static FractionPart greatestCommonDivisor(FractionPart a, FractionPart b); public: friend std::istream& operator>>(std::istream& input, Fraction& fraction); friend std::ostream& operator<<(std::ostream& output, const Fraction& fraction); }; // cin >> f1 >> f2 >> ... >> fN std::istream& operator>>(std::istream& input, Fraction& fraction); // cout << f1 << f2 << ... << fN std::ostream& operator<<(std::ostream& output, const Fraction& fraction); // can be implemented as member function also Fraction operator+(const Fraction& f1, const Fraction& f2); #endif