Pages

Friday, January 25, 2013

Xcode/cout/complex problem

Hi,

 

I have tried a few fora with this query and so far no luck. The following really simple segment:

 

#include
#include

int main (int argc, char * const argv[])
{
    std::complex<double> a(1.,1.);
    std::cout << "a = "<< a << "\n";
    return 0;
}

 

using Xcode 3.2 (the project setting is 'Command Line tool') on OSX 10.6.8 compiles fine and produces the following output:

 

a = (

 

 

when of course it should produce:

 

a = (1.,1.)

 

Yes, I can display the real and imaginary parts using a.real(), a.imag() but the above should work.

 

Any ideas why Xcode has this weird behaviour?

Has anyone else seen this?

Thanks in advance,

mk ii


View the original article here

0 comments:

Post a Comment