hello my friends :
i thought a lot of how i program the general combined number
in the form a+i*b
while i = sqrt(-1)
the problem to be in the compiler don`t take the value sqrt (-1)
as it However i*i also cant display
i thanks very much if you help me for this matter
#include <iostream>
#include <complex>
usingnamespace std;
typedef complex<double> comp; // to type less on declarations
int main()
{
const comp i = sqrt ( comp(-1) ); // force the call to the overload of sqrt found in <complex>
comp x = 1.0 + i * 2.0;
comp y ( 3, 4 ); // 3 + 4*i
cout << x+y << endl // default format: (real,imag )
<< x.real() << " + i*" << x.imag() << endl; // custom format: real + i*imag
}