在线文档教程
C++
数字 | Numerics

std::complex::imag

STD::Complex::IMAG

primary template complex
T imag() const;(1)(until C++14)
constexpr T imag() const;(1)(since C++14)
void imag( T value (2)
specialization complex<float>
float imag() const;(1)(until C++11)
constexpr float imag((1)(since C++11) (until C++14)
constexpr float imag() const;(1)(since C++14)
void imag( float value (2)
specialization complex<double>
double imag() const;(1)(until C++11)
constexpr double imag((1)(since C++11) (until C++14)
constexpr double imag() const;(1)(since C++14)
void imag( double value (2)
specialization complex<long double>
long double imag() const;(1)(until C++11)
constexpr long double imag((1)(since C++11) (until C++14)
constexpr long double imag() const;(1)(since C++14)
void imag( long double value (2)

访问复数的虚部。

1%29返回虚部。

2%29设置虚部value...

参数

value-the value to set the imaginary part to

另见

imagreturns the imaginary component (function template)
realaccesses the real part of the complex number (public member function)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/数值/复合/imag