C examples for complex.h:imag
public member function
<complex> <complex.h>
T imag() const; void imag (T val);
Imaginary part
The imaginary part. T is complex's template parameter.
#include <iostream> #include <complex> int main ()//from w w w .ja v a2s . c o m { std::complex<double> mycomplex (20.0,2.0); std::cout << "Imaginary part: " << mycomplex.imag() << '\n'; return 0; }