C语言sin()用来计算参数x 的正玄值,然后将结果返回.返回-1 至1 之间的计算结果.
例子:
#include math.h
main(){
}
执行
C语言sin():
sin()原型:double sin(double x)
sin()角度与弧度:
扩展资料:
与sin相似的acos函数
函数名: acos
功 能:计算并返回arccos(x)值、要求-1=X=1
函数与形参类型:
double acos(x)
double x;
程序例:
#include stdio.h
#include math.h int main(void)
{
double result;
printf("The arc cosine of %lf is %lf\n", x, result);
return 0;
参考资料:CSDN博客频道-C语言中sin和cos的用法
首先,你输出的不是正弦图像,而是反正弦图像.
#includestdio.h
#includemath.h
int
double
y;
x,m,i;
printf("y=sin(x)
for(y=1;y=-1;y-=0.1){//表示y的取值范围是[-1,1]
if(y=0){
m=asin(y)*10;
for(x=1;xm;x++)printf("
");
//printf("*",m);
printf("*");//注意此时不换行,因为后面还有一个点
");//输出第二个点,并换行
printf("*\n");}
else{//同理输出y小于0的点
m=-1*asin(y)*10;
printf("*");
printf("*\n",m);
getchar();
return
0;
C语言里sin函数和cos函数是C标准数学函数库中的函数,调用需要引入math.h头文件.
第一段:sin()?函数描述:
C 库函数 double sin(double x) 返回弧度角 x 的正弦.sin() 函数的声明:double sin(double x).
参数:x -- 浮点值,代表了一个以弧度表示的角度.
返回值:该函数返回 x 的正弦.
第二段:cos() 函数描述:
cos() 函数的功能是求某个角的余弦值.cos()?函数的声明:double cos(double x).
返回值:该函数返回 x 的余弦.
相关的三角函数:
double acos (double); 结果介于[0,PI]
以上就是土嘎嘎小编为大家整理的c语言中正弦函数相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!