c语言三角函数计算


头文件:math.h
计算:
sin32=sin(x*180/Pi)
其他类似

因为要输入弧度才可以计算,直接sin(30)是不行的。

sin(x)
cos(x)
tan(x)

arcsin(x)
arccos(x)
arctan(x)
arccot(x)

以上四个则是相应的反三角函数,函数值的单位也是弧度。若要求arctan(1)的度数,要用以下的形式:
arctan(1)*180/3.1415926

例子

#include<stdio.h>
#include<math.h>
int main() 
{ 
const double Pi=3.14; //定义pi的值
double a; 
a=sin(45*180/Pi); //角度转化为弧度
printf("%f",a); //printf的正确格式
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM