Create a class rational which represents a numerical value


Program

Create a class Rational which represents a numerical value by two double values-NUMERATOR & DENOMINATOR. Include the following Public member Functions:

  • Constructor With no Arguments
  • Constructor with two arguments
  • Void reduce() tha reduces the rational nuber by eliminating the hightest commom factor between the numeratorand denominator
  • Overload +operator to add two rational number.
  • Overload >>operator to enable input through cin.
  • Overload << operator to enable output through cout

Write a main()  to test all thje functions in the class.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Create a class rational which represents a numerical value
Reference No:- TGS01475445

Now Priced at $10 (50% Discount)

Recommended (93%)

Rated (4.5/5)