C complex number usage
Michael ODonnell
michael.odonnell at comcast.net
Sun Jan 6 17:16:20 EST 2008
Um, I think you're basically OK and only need to
extract the real and imaginart portions properly,
maybe something like this:
#include <cstdlib>
#include <iostream>
#include <complex>
using namespace std;
int main(int argc, char *argv[])
{
double a, b;
complex<double> c;
a = 1.0; // a is the real part
b = 1.0; // b is the imaginary part
c = (a,b); // form the complex number
cout << c.real() << "," << c.imag() << endl;
return EXIT_SUCCESS;
}
More information about the gnhlug-discuss
mailing list