Question
C++ A rational number is of the form a/b where a and b are integers with b not equal to zero. Develop a class for
C++
A rational number is of the form a/b where a and b are integers with b not equal to zero. Develop a class for processing rational numbers. The class should have a numerator data member and a denominator data member. It should read and display all rational numbers in the format a/b; for output, just display a if the denominator is 1. The following examples illustrate the operations that should be provided:
A rational number x can be entered in the form
a or a/b. (e.g. 4, 3/4, 5/2)
x + y addition
x - y subtraction
x * y multiplication
x / y division
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started