Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>class definition</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Class Definition

   The class complex is implemented as a set of overloaded operators and
   functions which provide a general complex mathematics capability. A
   complex number is defined by a real part re, and an imaginary part im,
   which are each stored in the complex class with type double.

   class complex
   {
   public:
   //constructors
       complex();
       complex(double re, double im );
       complex(const complex& z);

   // operators
       // arithmetic:
       friend complex operator+(const complex&, const complex&);
       friend complex operator-(const complex&, const complex&);
       friend complex operator*(const complex&, const complex&);
       friend complex operator/(const complex&, const complex&);

       // relational:
       friend int operator&&(const complex&, const complex&);
       friend int operator||(const complex&, const complex&);
       friend int operator!=(const complex&, const complex&);
       friend int operator==(const complex&, const complex&);

       // assignment:
       complex& operator=(const complex&);
       complex& operator+=(const complex&);
       complex& operator-=(const complex&);
       complex& operator*=(const complex&);
       complex& operator/=(const complex&);

       // unary:
       int operator! () const;
       complex operator- () const;

       // streams:
       friend ostream& operator<<(ostream& s, const complex& x);
       friend istream& operator>>(istream& s, const complex& x);

   // Functions
       double& real ();
       double& imag ();
       friend double real(const complex&);
       friend double imag(const complex&);
       friend complex conj(const complex&);
       friend double norm(const complex&);
       friend double modulus(const complex&);
       friend double arg(const complex&);
       friend complex polar(double range, double theta);

   // Trigonometric and Hyperbolic functions
       friend complex cos(const complex&);
       friend complex cosh(const complex&);
       friend complex sin(const complex&);
       friend complex sinh(const complex&);
       friend complex tan(const complex&);
       friend complex tanh(const complex&);
       friend complex asin(const complex&);
       friend complex acos(const complex&);
       friend complex atan(const complex&);
       friend complex asinh(const complex&);
       friend complex atanh(const complex&);

   // Mathematical functions
       friend complex exp(const complex&);
       friend complex log(const complex&);
       friend complex log10(const complex&);
       friend complex sqrt(const complex&);
       friend double abs(const complex&);
       friend complex pow(const complex&, double);

       friend complex pow(const complex&, const complex &);
       friend complex pow(double, const complex&);
       friend complex pow(const complex&, int);
   };




Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson