complex::real

복잡 한 숫자의 실제 구성 요소를 가져오거나 설정 합니다.

Type real( ) const;
Type real(const Type& _Right);

매개 변수

  • _Right
    실제 값 추출 하는 복잡 한 숫자.

반환 값

복소수의 실수 부분입니다.

설명

복소수에 대 한 a + bi, 실제 부품 또는 구성 요소인 Re(a + bi) a. =

예제

// complex_class_real.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