C examples for complex.h:real
function template
<complex> <complex.h>
template<class T> T real (const complex<T>& x); double real (ArithmeticType x); // additional overloads
Returns the real part of the complex number x.
Parameter | Description |
---|---|
x | Complex value. |
Real part of x. T is the type of the components of the complex type (i.e., its value type).
#include <iostream> // std::cout #include <complex> // std::complex, std::real int main ()/*w w w.jav a2 s. c o m*/ { std::complex<double> mycomplex (10.0,1.0); std::cout << "Real part: " << std::real(mycomplex) << '\n'; return 0; }