Using visual C++ how do you use complex numbers in equations?
Printable View
Using visual C++ how do you use complex numbers in equations?
I'd be glad to help...I'll just need a better description of 'complex numbers'
-P
There is a STL templated complex number class:
For example:
The normal arithmetic operators are defined for it as well as == and !=.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)