Condividi tramite


complex::imag

Estrae la parte immaginaria di un numero complesso.

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

Parametri

  • _Right
    Un numero complesso del cui valore immaginario deve essere estrattoe.

Valore restituito

Parte immaginaria del numero complesso.

Note

Per un numero complesso a + la Bi, la parte immaginaria o il componente è Im (a Bi +) = B.

Esempio

// 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;
}
  

Requisiti

complesso <diIntestazione: >

Spazio dei nomi: std

Vedere anche

Riferimenti

Classe complex