Sep 17, 2011 at 12:59pm UTC
Hi ,
I'm new in c++ and i learn c++ from java2s.com.There are many examples.
Could someone explain me,why complex is used in c++,please?
Example:#include <complex>
#include <iostream>
using namespace std;
int main( ) {
double rho = 3.0; // magnitude
double theta = 3.141592 / 2; // angle
complex<double> coord = polar(rho, theta);
cout << "rho = " << abs(coord) << ", theta = " << arg(coord) << endl;
coord += polar(4.0, 0.0);
cout << "rho = " << abs(coord) << ", theta = " << arg(coord) << endl;
}
Sep 17, 2011 at 3:11pm UTC
The question is unclear. Are you asking what are complex numbers used for?
Sep 17, 2011 at 3:13pm UTC
I mean where complex class and it's functions are used...
Could you explain with examples ,where complex numbers are useful for use..
Last edited on Sep 17, 2011 at 3:18pm UTC
Sep 17, 2011 at 3:15pm UTC
They're used when complex numbers are needed, of course..