曲径通幽论坛

标题: cos() -- 计算余弦值 [打印本页]

作者: beyes    时间: 2011-12-22 17:43
标题: cos() -- 计算余弦值
cos() 函数原型为:
[Plain Text] 纯文本查看 复制代码
#include <math.h>
double cos(double x);

该函数用来计算参数 x 的余弦值并将结果返回,结果的范围在 -1 和 1 之间。

测试代码
[C++] 纯文本查看 复制代码
#include <stdio.h>
#include <math.h>

int main()
{      
        printf ("cos(0.5) = %f\n", cos(0.5));
        
        return 0;
}   

运行输出:
./cos
cos(0.5) = 0.877583





欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) Powered by Discuz! X3.2