I want to use C++ with complex numbers. Therefore I included #include . Now my question is: How do I declare a variable?(so what is the format ca
Here is an example of how to use . It compiles and runs under QT
#include
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
std::complex x=3.0-3.0i;
std::complex y=2.0+4.0i;
cout.precision(3);
cout<<"x="< sum = x + y;
cout<<"The sum: x + y = "< difference = x - y;
cout<<"The difference: x - y = "< product = x * y;
cout<<"The product: XY = "< quotient = x / y;
cout<<"The quotient: x / y = "< conjugate = conj(x);
cout<<"The conjugate of x = "< reciprocal = 1.0/x;
cout<<"The reciprocal of x = "< exponential =exp(x);
cout<<"The exponential of x = "< pol= std::polar(2.0,(M_PI/180.0)*phase);
cout<<"The polar: x , y = "<