24.2 NUMBERS
class Complex
{ private : double x, y ; public: Complex( double a, double b) ; Complex(); void show() ; Complex operator +( Complex b ); Complex operator -( Complex b ); Complex operator *( Complex b); Complex operator /( Complex b); Complex operator ~( ); };
Class complex will be useful in programs involving such numbers. Real and imaginary parts are defined as “double”. This is the type which can hold very large or very small real numbers.
class RatNum
{ private long num,den; double value; public: RatNum(long a, long b); RatNum(); void show(); RatNum operator+(RatNum nx) ; RatNum operator++() ; RatNum operator++(int) ; RatNum ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access