home *** CD-ROM | disk | FTP | other *** search
/ Microsoftware Monthly 19…2 Programming Power Tools / MASO9512.ISO / cpptutor / cpptutor.arj / CH10 / A10224.TXT < prev    next >
Encoding:
Text File  |  1993-09-30  |  452 b   |  8 lines

  1. To reduce a Fraction object to its simplest form, the numerator
  2. and denominator are divided by their greatest common divisor.  The
  3. private member function gcd() takes two arguments and returns
  4. their greatest common divisor.  Here, for example, if "num" has
  5. the value 6 and "denom" has the value 8, gcd() returns the value
  6. 2. Both "num" and "denom" are divided by 2. The resulting value,
  7. 3/4, is the value that is stored for the Fraction object.
  8.