Hollowfires

Untitled

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