×

# cosh() function with example in C++

C++ cosh() function: Here, we are going to learn about the cosh() function with example of cmath header in C++ programming language?
Submitted by IncludeHelp, on April 28, 2019

## C++ cosh() function

cosh() function is a library function of cmath header, it is used to find the hyperbolic cosine of the given value (hyperbolic angle), it accepts a number (x) and returns the hyperbolic cosine of x.

## Syntax

Syntax of cosh() function:

```cosh(x);
```

## Parameter(s)

x – is the number (hyperbolic angel) to be used to calculate the hyperbolic cosine.

## Return value

double – it returns double type value that is the hyperbolic cosine of hyperbolic angle x.

## Sample Input and Output

```Input:
float x = 2.45;

Function call:
cosh(x);

Output:
5.83732
```

## Example

```// C++ code to demonstrate the example of
// cosh() function

#include <iostream>
#include <cmath>
using namespace std;

// main() section
int main()
{
float x;

x = -10.23;
cout<<"cosh("<<x<<"): "<<cosh(x)<<endl;

x = 0;
cout<<"cosh("<<x<<"): "<<cosh(x)<<endl;

x = 2.45;
cout<<"cosh("<<x<<"): "<<cosh(x)<<endl;

return 0;
}
```

### Output

```cosh(-10.23): 13861.2
cosh(0): 1
cosh(2.45): 5.83732
```

Reference: C++ cosh() function