Home » C++ programming language

sinh() function with example in C++

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

C++ sinh() function

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

Syntax of sinh() function:

    sinh(x);

Parameter(s): x – is the number (hyperbolic angel) to be used to calculate the hyperbolic sine.

Return value: double – it returns double type value that is the hyperbolic sine of hyperbolic angle x.

Example:

    Input:
    float x = 2.45;
    
    Function call:
    sinh(x);    
    
    Output:
    5.75103

C++ code to demonstrate the example of sinh() function

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

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

// main() section
int main()
{
    float x;
    
    x = -10.23;
    cout<<"sinh("<<x<<"): "<<sinh(x)<<endl;

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

    x = 2.45;
    cout<<"sinh("<<x<<"): "<<sinh(x)<<endl;    
    
    return 0;
}

Output

sinh(-10.23): -13861.2
sinh(0): 0
sinh(2.45): 5.75103

Reference: C++ sinh() function



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.