c语言中cos函数的用法
来源:百度知道 编辑:UC知道 时间:2024/05/14 07:22:53
cos函数的输入值为弧度,也就是将cos函数后加上弧度,然后就可以得到想要的结果。我们需要把度化为弧度:
假设度数为d,则对应的弧度为:d * pi / 180
同学,以下请仔细参详, 不是有意做长, 实在是都有用.
Trigonometry Functions (Sample)
The sample code below illustrates how to use trigonometry (sin, cos, tan, and so on) functions in Visual C++.
Required Header:
<valarray>
Prototype:
// acos
template<class T>
inline valarray<T> acos(const valarray<T>& x);
// asin
template<class T>
inline valarray<T> asin(const valarray<T>& x);
// atan
template<class T>
inline valarray<T> atan(const valarray<T>& x);
// atan2
template<class T>
inline valarray<T> atan2(const valarray<T>& x, const valarray<T>& y);
template<class T>
inline valarray<T> atan2(const valarray<T> x, const T& y);
template<class T&g