Using visual C++ how do you use complex numbers in equations?

Printable View

- 09-09-2001RichNeed Help with using complex numbers
Using visual C++ how do you use complex numbers in equations?

- 09-09-2001Prelude
I'd be glad to help...I'll just need a better description of 'complex numbers'

-P - 09-09-2001Zach L.
There is a STL templated complex number class:

For example:

Code:`#include <complex>`

typedef std::complex<double> complex;

int main()

{

complex c(2.9, 3.5), d(3.54, 3.5), e; // constructor: complex(real, imaginary)

e = c + d;

// etc.

}

The functions defined for it are:

complex.real()

complex.imag()

conj(complex)

abs(complex)

arg(complex)

norm(complex)

polar(complex)