Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A rational number is a quotient of two integers. For example, 12/5, 12/-4, -314, and 4/6
- are all rational numbers. A rational number is said to be in reduced form if its denominator
- is positive and its numerator and denominator have no common divisor other than 1. For
- example, the reduced forms of the rational numbers given above are 12/5, -311, -314,
- and 2/3.
- Write a class called Rational with a constructor Rational (int, int) that takes two
- integers, a numerator and a denominator, and stores those two values in reduced form in
- corresponding private members. The class should have a private member function void
- reduce ( ) that is used to accomplish the transformation to reduced form. The class should
- have an overloaded insertion operator << that will be used for output of objects of the
- class.
Advertisement
Add Comment
Please, Sign In to add comment