complex::imag

提取一个复数的虚构的元素。

Type imag( ) const;
Type imag(const Type& _Right);

参数

  • _Right
    虚构的值将被提取的一个复数。

返回值

复数的虚部。

备注

对于一个复数 + double、虚构部分或元素是 Im (+二进制文件) = b。

示例

// complex_imag.cpp
// compile with: /EHsc
#include <complex>
#include <iostream>

int main( )
{
   using namespace std;

   complex <double> c1 ( 4.0 , 3.0 );
   cout << "The complex number c1 = " << c1 << endl;

   double dr1 = c1.real ( );
   cout << "The real part of c1 is c1.real ( ) = "
        << dr1 << "." << endl;

   double di1 = c1.imag ( );
   cout << "The imaginary part of c1 is c1.imag ( ) = "
        << di1 << "." << endl;
}
  
  

要求

标头: <complex>

命名空间: std

请参见

参考

complex Class