Complex numbers
A complex number z = x + yi is the sum of a real number x and a real number y multiplied by the imaginary unit i, i 2 = -1 ⇒ i = ±√(-1) , which is the solution of the equation x 2 + 1 = 0.
Complex.h
namespace SmallWindows { class NotaComplexNumber : public exception { public: NotaComplexNumber() {/* Empty. */} }; extern double Square(double value);
The constructors, assignment operators, and the String
conversion operator are similar to their counterparts in Rational
:
class Complex { public: Complex(double x = 0, double y = 0); Complex(const Complex &complex); Complex operator=(const Complex &complex); bool ReadStream(const String& text); Complex(const String& text); operator String() const;
When comparing two complex number, ...
Get C++ Windows Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.