C++ : sin、cos、tan、arctan的使用 | 您所在的位置:网站首页 › arctan计算器手机能算么 › C++ : sin、cos、tan、arctan的使用 |
原文参考 最重要的几条: C++中sin、cos、tan、asin、acos、atan等三角函数的输入是弧度,而不是角度注意tan、atan等函数不能接受整数,tan(45)会报错“error C2668: 'tan' : ambiguous call to overloaded function”弧度和角度的转换:角度 45度-》弧度 45*PI/180弧度值转角度 弧度值 * 180/PI----------------------------------------------------------------------------------------------------------------------------------------------------------- 来源于原文的代码,写在这里是只是为了更加方便一些 #include #include using namespace std; #define PI 3.1415926 int main() { //注意tan、atan等函数不能接受整数,tan(45)会报错“error C2668: 'tan' : ambiguous call to overloaded function” float tanValue1 = tan(45.0f); float tanValue2 = tan(45*PI/180.0f); cout |
CopyRight 2018-2019 实验室设备网 版权所有 |