c+ +三角函数_C ++中的三角函数

c+ +三角函数

C ++三角函数 (C++ Trigonometric functions)

Trigonometric functions are also called circular functions or angle functions or goniometric functions, which are used to trigonometric computations like computing cosine, sine, tangent values.

三角函数也称为圆函数角度的功能测角函数 ,其用于三角函数的计算等计算余弦,正弦,正切值。

三角函数列表 (List of trigonometric functions)

Here is the list of all trigonometric functions with descriptions and their syntaxes,

这是所有三角函数及其说明和语法的列表,

Trigonometric functionsDescriptionSyntax
cos()It returns the cosine of an angle of x radians.cos(x)
sin()It returns the sine of an angle of x radians.sin(x)
tan()It returns the tangent of an angle of x radians.tan(x)
acos()It returns the arc cosine of x in radians.acos(x)
asin()It returns the arc sine of x in radians.asin(x)
atan()It returns the arc tangent of x in radians.atan(x)
atan2()It returns the arc tangent of y/x in radians.atan2(y,x)
三角函数 描述 句法
cos() 它返回x弧度角的余弦值。 cos(x)
罪() 它返回x弧度角的正弦。 sin(x)
tan() 它返回x弧度角的切线。 tan(x)
acos() 它以弧度返回x的反余弦值。 acos(x)
asin() 它以弧度返回x的反正弦值。 asin(x)
晒黑() 它以弧度返回x的反正切。 阿坦(x)
atan2() 它以弧度返回y / x的反正切。 atan2(y,x)

C ++代码演示三角函数示例 (C++ code to demonstrate example of trigonometric functions)

// C++ code to demonstrate the example of 
// trigonometric functions

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

// main() section
int main()
{
    float x;
    float y;
    
    x = 0.25;
    cout<<"cos("<<x<<") : "<<cos (x)<<endl;
    cout<<"sin("<<x<<") : "<<sin (x)<<endl;
    cout<<"tan("<<x<<") : "<<tan (x)<<endl;
    cout<<"acos("<<x<<"): "<<acos(x)<<endl;
    cout<<"asin("<<x<<"): "<<asin(x)<<endl;
    cout<<"atan("<<x<<"): "<<atan(x)<<endl;
    y = 1.0;
    cout<<"atan2("<<y<<","<<x<<"): "<<atan2(y,x)<<endl;    
    
    return 0;
}

Output

输出量

cos(0.25) : 0.968912
sin(0.25) : 0.247404
tan(0.25) : 0.255342
acos(0.25): 1.31812
asin(0.25): 0.25268
atan(0.25): 0.244979
atan2(1,0.25): 1.32582

Reference: C++ cmath header

参考: C ++ cmath标头

翻译自: https://www.includehelp.com/cpp-tutorial/trigonometric-functions.aspx

c+ +三角函数

  • 6
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值