In a language that supports operator overloading, build support for rational numbers. Each number should be represented

Question:

In a language that supports operator overloading, build support for rational numbers. Each number should be represented internally as a (numerator, denominator) pair in simplest form, with a positive denominator. Your code should support unary negation and the four standard arithmetic operators. For extra credit, create a conversion routine that accepts two floatingpoint parameters—a value and a error bound—and returns the simplest (smallest denominator) rational number within the given error bound of the given value.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: