T imag() const;
void imag (T val);
i
T
123456789101112
// complex::imag example #include <iostream> // std::cout #include <complex> // std::complex int main () { std::complex<double> mycomplex (20.0,2.0); std::cout << "Imaginary part: " << mycomplex.imag() << '\n'; return 0; }
Imaginary part: 2