The cosh()
function in C++ is used to return the hyperbolic cosine of an angle given in radians.
Mathematically:
Cosh(x) =
double cosh(double x);
float cosh(float x);
long double cosh(long double x);
The cosh()
function takes a single argument x
, which represents the hyperbolic angle in radians.
The cosh()
function returns the hyperbolic cosine of the argument passed to it.
#include <iostream>#include <cmath>using namespace std;int main(){// creating a variabledouble x = 5.25, result;// applying the cosh() functionresult = cosh(x);// printing our outputcout << "cosh(x) = " << result << endl;return 0;}
x
.cosh()
function for the variable x
and assign the output to a new variable result
.result
.