Click to See Complete Forum and Search --> : Problems with Complex Math in C++


Marcel
April 16th, 1999, 07:17 PM
I'm new to C and C++ programming and I've chosen MS VC++ V6.0 for my
work. The question that I have is:

How do I declare complex variables, arrays and functions in C++ V6.0?
I understand that I need to include the appropriate header file in my source code. I do this using:

#include <complex>



Everything that I've tried has failed.
By the way, at this time I'm just trying to implement a simple console
program.

Lynx
April 17th, 1999, 02:23 AM
You need to make the complex into the namespace, for example:
#include <complex>
using namespace std;

//......
complex<double> d1(10, 5), d2(5, 10);
d1 += d2; // d1.real() = 15, d1.imag() = 15
//........

Hope this will help. Good luck.

Lynx