C ++中的三角函数
C++三角函数
三角函数也称为圆函数或角度函数或测角函数,其用于三角函数的计算等计算余弦,正弦,正切值。
三角函数列表
这是所有三角函数及其说明和语法的列表,
C++代码演示三角函数示例
//示例
//三角函数
#include <iostream>
#include <cmath>
using namespace std;
// main()部分
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;
}输出结果
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
参考:C++cmath标头
热门推荐
10 朋友新年祝福语大全 简短
11 新年祝福语简短大方兔年
12 搬新家礼物祝福语简短
13 同学见面花束祝福语简短
14 五一假期祝福语幽默简短
15 离职欢送敬酒祝福语简短
16 对学弟的祝福语简短
17 考老师辞职祝福语简短
18 祝福语驱散霉运的话简短