real function - C complex.h

C examples for complex.h:real

type

public member function

From


<complex>
<complex.h>

Prototype

T real() const;
void real (T val);

Description

Returns the real part of the complex number.

Parameters

none

Return value

The real part.

Demo Code


#include <iostream> // std::cout
#include <complex> // std::complex

int main ()//from  ww w . j a  v a  2 s.c o  m
{
  std::complex<double> mycomplex (10.0,1.0);

  std::cout << "Real part: " << mycomplex.real() << '\n';

  return 0;
}

Related Tutorials