网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

C语言写sine函数 c语言中sin函数的用法

如何用C语言实现三角函数的计算

math.h里的三角函数用的单位是弧度,你貌似错在这里。 答案补充 Example

创新互联公司主营蜀山网站建设的网络公司,主营网站建设方案,重庆App定制开发,蜀山h5微信小程序搭建,蜀山网站营销推广欢迎蜀山等地区企业咨询

/* SINCOS.C: This program displays the sine, hyperbolic

* sine, cosine, and hyperbolic cosine of pi / 2.

*/

#include math.h

#include stdio.h

void main( void )

{

double pi = 3.1415926535;

double x, y;

x = pi / 2;

y = sin( x );

printf( "sin( %f ) = %f\n", x, y );

y = sinh( x );

printf( "sinh( %f ) = %f\n",x, y );

y = cos( x );

printf( "cos( %f ) = %f\n", x, y );

y = cosh( x );

printf( "cosh( %f ) = %f\n",x, y );

} 答案补充 Output

sin( 1.570796 ) = 1.000000

sinh( 1.570796 ) = 2.301299

cos( 1.570796 ) = 0.000000

cosh( 1.570796 ) = 2.509178

Parameter

x

Angle in radians

怎样用c语言编写一个程序用来输出正弦函数值

首先:程序应该这样改!

#include

#include

main()

{

double

n;

double

b,c;

scanf("%lf",n);

b=sin(n);

c=cos(n);

printf("%.2lf\n%.2lf",b,c);

return

0;

}

其次,这里的n是弧度值,你说的90度应该输入的是pi/2,而不是90,如果希望输入90的话,那就这样改!

#include

#include

main()

{

int

s;

double

n,b,c;

scanf("%d",s);

n=3.1415926*(s/180.0);

b=sin(n);

c=cos(n);

printf("%.2lf\n%.2lf",b,c);

return

0;

}

C语言编写sin函数?求教!

#include"stdio.h"

#include"math.h"

double mysin(double x)

{double y=x,t=x,t1=x*x;

for(int i=2;fabs(t)1e-10;i+=2)

{t*=-t1/(i*(i+1));

y+=t;

}

return y;

}

int main()

{ double x;

scanf("%lf",x);

printf("%f\n",mysin(x));

return 0;

}


文章标题:C语言写sine函数 c语言中sin函数的用法
本文网址:http://bjjierui.cn/article/ddoscgp.html

其他资讯