C ++ STL中的cosh()函数
该cosh()函数返回以弧度给出的角度的双曲余弦值。它是C++STL中的内置函数。
该cosh()函数的语法如下。
cosh(var)
从语法可以看出,该函数cosh()接受数据类型为float,double或longdouble的参数var。它返回var的双曲余弦值。
cosh()用C++演示的程序如下-
示例
#include <iostream>
#include <cmath>
using namespace std;
int main() {
double d = 5, ans;
ans = cosh(d);
cout << "cosh("<< d <<") = " << ans << endl;
return 0;
}输出结果
cosh(5) = 74.2099
在上面的程序中,首先将变量d初始化。然后使用找出d的双曲余弦cosh()并将其存储在ans中。最后,显示ans的值。下面的代码片段对此进行了演示。
double d = 5, ans;
ans = cosh(d);
cout << "cosh("<< d <<") = " << ans << endl;如果以度为单位提供值,则在使用cosh()函数之前将其转换为弧度。因为它返回以弧度给出的角度的双曲余弦值。
示例
#include <iostream>
#include <cmath>
using namespace std;
int main() {
double degree = 60, ans;
degree = degree * 3.14159/180;
ans = cosh(degree);
cout << "cosh("<<degree<<") = " << ans << endl;
return 0;
}输出结果
cosh(1.0472) = 1.60029
在上述程序中,该值以度为单位。因此将其转换为弧度,然后使用来获得双曲余弦cosh()。最后,显示输出。下面的代码片段对此进行了演示。
double degree = 60, ans;
degree = degree * 3.14159/180;
ans = cosh(degree);
cout << "cosh("<<degree<<") = " << ans << endl;热门推荐
10 诗词送行祝福语大全简短
11 新房开工吉日祝福语简短
12 50多岁生日简短祝福语
13 安徽疫情祝福语简短英语
14 农民朋友发财祝福语简短
15 对生活祝福语简短精辟
16 搬家词简短祝福语朋友
17 女神结婚快乐祝福语简短
18 文学短句祝福语大全简短