Continue the development of the Fraction
class by adding overloaded operators for addition, subtraction, multiplication, division, and various kinds of comparison. In each case the parameter should be a const Fraction&
. Write client code to test your new operators.
To be useful, a Fraction
object should be able to interact with other kinds of numbers. Expand the definition of Fraction
so that the operators in your solution to Problem 1 also work for int
and double
. It should be clear, for example, how to get frac + num
to be correctly evaluated. How would you handle the expression num + frac
, where frac
is a Fraction
and num
is an int
? Write client code to test your new functions.
Add arithmetic and comparison operators to the class Complex
. Write client code to test your expanded class.
[ fromfile: functions.xml id: None ]
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |