C examples for complex.h:imag
function template
<complex> <complex.h>
template<class T> T imag (const complex<T>& x); double imag (ArithmeticType x); // additional overloads
Imaginary part of complex
Parameter | Description |
---|---|
x | Complex value. |
Imaginary part of x.
#include <iostream> // std::cout #include <complex> // std::complex, std::imag int main ()// w w w .j a v a 2 s .c o m { std::complex<double> mycomplex (20.0,2.0); std::cout << "Imaginary part: " << std::imag(mycomplex) << '\n'; return 0; }