Using the same definition of the rational numbers as in problem P85696, write the functions

Rational sum(const Rational& a, const Rational& b);
Rational substraction(const Rational& a, const Rational& b);
Rational product(const Rational& a, const Rational& b);
Rational division(const Rational& a, const Rational& b);

that returns respectively the sum, the substraction, the product and the division of two rational numbers given, “normalized” according to the same convention that in the exercise .

Write also the procedure

void adds_one(Rational& r);

that adds an unit to the rational number *r*.

Precondition

The rational numbers *a* and *b* are correct and normalized.
In the case of division, *b* ≠ 0.

Observation You only need to submit the required classes; your main program will be ignored. Strictly obey the type definitions of the statement.

Information

- Author
- Salvador Roura
- Language
- English
- Translator
- Carlos Molina
- Original language
- Catalan
- Other languages
- Catalan
- Official solutions
- C++
- User solutions
- C++