Guest_imported
New member
- Jan 1, 1970
- 0
Hi,
I'm a C++ beginner and I really need some help to write a C++ program that implements an ADT class named Rational for manipulating rational (fraction) numbers.
The operations provided on this type must include: sum (+), difference (-), product (*), division (/), display (<<), and input (>>) of values for Rational objects.
The result produced by each arithmetic operation must automatically be reduced to lowest terms (change 72/28 to 18/7).
I have to allow for positive and negative values and have to use the class in a program that gives the user the ability to enter data and perform each of the calculations. The operator overloading must support expressions like:
R3 =R1+ R2; //each variable is of type Rational
cout << "results:" << R4 << " & " << R5 << endl;
Any examples or suggestions are really appreciated.
Mark S.
I'm a C++ beginner and I really need some help to write a C++ program that implements an ADT class named Rational for manipulating rational (fraction) numbers.
The operations provided on this type must include: sum (+), difference (-), product (*), division (/), display (<<), and input (>>) of values for Rational objects.
The result produced by each arithmetic operation must automatically be reduced to lowest terms (change 72/28 to 18/7).
I have to allow for positive and negative values and have to use the class in a program that gives the user the ability to enter data and perform each of the calculations. The operator overloading must support expressions like:
R3 =R1+ R2; //each variable is of type Rational
cout << "results:" << R4 << " & " << R5 << endl;
Any examples or suggestions are really appreciated.
Mark S.