template<class T> complex<T> polar (const T& rho, const T& theta = 0);
12
real = rho * cos(theta); imag = rho * sin(theta);
123456789101112
// polar example #include <iostream> // std::cout #include <complex> // std::complex, std::polar int main () { std::cout << "The complex whose magnitude is " << 2.0; std::cout << " and phase angle is " << 0.5; std::cout << " is " << std::polar (2.0, 0.5) << '\n'; return 0; }
The complex whose magnitude is 2 and phase angle is 0.5 is (1.75517,0.958851)