complex::complex - C complex.h

C examples for complex.h:constructor

Type

public member function

From


<complex>
<complex.h>

Description

Complex number constructor

Prototype

template<class U>  complex (const complex<U>& x);
                   complex (const T& re = T(), const T& im = T());
                   complex (const complex& x);

Demo Code

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

int main ()//from www  .  j a v  a 2 s .c o  m
{
  std::complex<double> first (2.0,2.0);
  std::complex<double> second (first);
  std::complex<long double> third (second);

  std::cout << third << '\n';

  return 0;
}

Related Tutorials