123456789101112131415161718192021222324 |
- #include <iostream>
-
- using namespace std;
-
- class Rational {
- private:
- int num, den;
- public:
- Rational();
- Rational(int n, int d);
- void reduce();
- Rational sum(const Rational &b) const;
- Rational operator+(const Rational &b) const;
-
- double operator+(double b) const;
-
- Rational operator*(const Rational &b) const;
- bool gt(const Rational &b) const;
- bool operator>(const Rational &b) const;
- void display() const;
- double real() const;
- };
-
- double operator+(double a, const Rational &b);
|