发布网友 发布时间:2022-04-21 23:40
共4个回答
热心网友 时间:2023-07-09 22:44
C语言sin()用来计算参数x 的正玄值,然后将结果返回。返回-1 至1 之间的计算结果。
例子:
#include <math.h>
main(){
double answer = sin(0.5);
printf("sin(0.5) = %f\n", answer);
}
执行
sin(0.5) = 0.479426
C语言sin():
sin()原型:double sin(double x)
sin()角度与弧度:
π=180°
1°=π/180
1(rad)=180/π
角度转弧度:用角度乘以π/180
弧度转角度:用弧度乘以180/π,或者用rtod()函数
与sin相似的acos函数
函数名: acos
功 能:计算并返回arccos(x)值、要求-1<=X<=1
函数与形参类型:
double acos(x)
double x;
程序例:
#include <stdio.h>
#include <math.h> int main(void)
{
double result;
double x = 0.5; result = acos(x);
printf("The arc cosine of %lf is %lf\n", x, result);
return 0;
}
参考资料:CSDN博客频道-C语言中sin和cos的用法
热心网友 时间:2023-07-09 22:44
输入一个double类型的数,调用c标准库中的sin函数即可。
函数原型:double sin(double x);
功能: 函数用来求给定值的正弦值
头文件:#include <math.h>
参数:给定的值(弧度)。
返回值:返回-1 至1 之间的计算结果。
示例:
#include<stdio.h>热心网友 时间:2023-07-09 22:45
加上#include<math.h>
就可以使用sin(x) cos(x)
但是要注意
#include<stdio.h>热心网友 时间:2023-07-09 22:45
#include<math.h>
#include <stdio.h>
void main()
{
int x;
x =30;
sin(x);
}