Question: Define a class called Rational that would represent rational numbers. Write a constructor that would accept two integers and initialize the numerator and denominator of
Define a class called Rational that would represent rational numbers. Write a constructor that would accept two integers and initialize the numerator and denominator of the object to their values. Also include a default constructor that would initialize the numerator to 0 and denominator to 1. Implement the member functions add, sub, mul, div, less, and equal to carry out the operations +, -, *, /,
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
