These constructors can be used to create complex objects.
There is no explicit complex destructor.
Arrays of Complex Numbers
You can use the complex constructor to initialize arrays of complex numbers. If the list of initial values is made up of complex values, each array element is initialized to the corresponding value in the list of initial vlaues. If the list of initial values is not made up of complex values, the real parts of the array elements are initialized to these initial values and the imaginary parts of the array elements are initialized to 0.
In the following example, the elements of array b are initialized to the values in the initial value list, but only the real parts of elements of array a are initialized to the values in the initial value list.
#include < complex.h >
int main()
{
complex a[3] = {1.0, 2.0, 3.0};
complex b[3] = {complex(1.0, 1.0), complex(2.0, 2.0), complex(3.0, 3.0)};
cout << "Here is the first element of a: " << a[0] << endl;
cout << "Here is the first element of b: " << b[0] << endl;
}
This example produces the following output:
Here is the first element of a: ( 1, 0) Here is the first element of b: ( 1, 1)
Constructs a complex number.
public:complex(double r, double i = 0.0)
This is supported on

Constructs a complex number.
The first argument, r, is assigned to the real part of the complex number. If you specify a second argument, it is assigned to the imaginary part of the complex number. If the second parameter is not specified, the imaginary part is initialized to 0.
public:complex()
This is supported on

Constructs a complex number . The real and imaginary parts of the complex number are initialized to (0, 0).
The assignment operators do not produce a value that can be used in an expression. The following code, for example, produces a compile-time error:
complex x, y, z; // valid declaration x = (y += z); // invalid assignment causes a compile-time error y += z; // correct method involves splitting expression x = y; // into separate statements.
Assigns the value of x * y to x.
public:void operator *=(const complex&)
This is supported on

public:inline void operator *=(complex)
This is supported on

Assigns the value of x + y to x.
public:inline void operator +=(complex)
This is supported on

public:inline void operator +=(const complex&)
This is supported on

Assigns the value of x - y to x.
public:inline void operator -=(complex)
This is supported on

public:inline void operator -=(const complex&)
This is supported on

Assigns the value of x / y to x.
public:inline void operator /=(complex)
This is supported on

public:void operator /=(const complex&)
This is supported on

These functions are internal to the complex class and should not be used by application programs.
public:void hexdiveq(complex)
This is supported on

An internal function called by operator/= when the application uses hexadecimal floating point and double values.
public:void hexmuteq(complex)
This is supported on

An internal function called by operator*= when the application uses hexadecimal floating point and double values.
public:void ieeediveq(complex)
This is supported on

An internal function called by operator/= when the application uses IEEE floating point and double values.
public:void ieeemuteq(complex)
This is supported on

An internal function called by operator*= when the application uses IEEE floating point and double values.