cos - C complex.h

C examples for complex.h:cos

type

function template

From


<complex>
<complex.h>

Prototype

template<class T> 
complex<T> cos (const complex<T>& x);

Description

Returns the cosine of the complex number x.

Parameters

Parameter Description
x Complex value, representing an angle expressed in radians.

Return value

Cosine of x.

Demo Code

#include <iostream>
#include <complex>

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

  std::cout << "The cosine of " << mycomplex << " is " << std::cos(mycomplex) << '\n';

  return 0;
}

Related Tutorials