C examples for complex.h:cos
function template
<complex> <complex.h>
template<class T> complex<T> cos (const complex<T>& x);
Returns the cosine of the complex number x.
Parameter | Description |
---|---|
x | Complex value, representing an angle expressed in radians. |
Cosine of x.
#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; }