c語言三角函數(shù)打法 c語言如何使用三角函數(shù)

C語言怎樣表示三角函數(shù)計算(注:要用“角度制”表示)編出代碼

調(diào)用math.h中的三角函數(shù),需要將角度值變換為弧度值,代碼如下:

成都創(chuàng)新互聯(lián)公司長期為數(shù)千家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊從業(yè)經(jīng)驗10年,關(guān)注不同地域、不同群體,并針對不同對象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺,與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為奉化企業(yè)提供專業(yè)的成都網(wǎng)站建設(shè)、網(wǎng)站制作,奉化網(wǎng)站改版等技術(shù)服務(wù)。擁有十載豐富建站經(jīng)驗和眾多成功案例,為您定制開發(fā)。

#includestdio.h

#includemath.h

#define PI 3.14159265359

int main()

{

float st,a;

scanf("%f",st);

a = st * PI/180;

printf("sin(st)=%f\n", sin(a));

printf("cos(st)=%f\n", cos(a));

return 0;

}

求三角函數(shù)的C語言算法!

從鍵盤輸入一個角度值,求出該角度的正弦值、余弦值和正切值。

#includeiostream

#includecmath

using namespace std;

const double pi(3.14159265);

void main()

{ double a,b;

cina;

b=a*pi/180;

cout"sin("a")="sin(b)endl;

cout"cos("a")="cos(b)endl;

cout"tan("a")="tan(b)endl;

}

求階乘

#includeiostream.h

int Factorial ( int ) ;

void main ()

{ int k ;

cout "Compute Factorial(k) , Please input k: " ;

cin k ;

cout k "! = " Factorial(k) endl ;

}

int Factorial ( int n )

{ if ( n == 0 )

return 1 ;

else

return n * Factorial ( n - 1 ) ;

}

x的n次方的函數(shù)

#include iostream

using namespace std;

double power (double x, int n);

void main(void)

{

cout "5 to the power 2 is " power(5,2) endl;

}

double power (double x, int n)

{

double val = 1.0;

while (n--)

val = val*x;

return(val);

}

c語言編寫三角函數(shù)

求sin的:參考下 #includestdio.h void main() { double x,a,b,sum=0; printf("請輸入x的弧度值:\n"); scanf("%lf",x); int i,j,count=0; for(i=1;;i+=2) { count++; a=b=1; for(j=1;j=i;j++) { a*=x; b*=(double)j; } if(a/b0.0000001) break; else { if(count%2==0) sum-=a/b; else sum+=a/b; } } printf("%lf\n",sum); }

文章名稱:c語言三角函數(shù)打法 c語言如何使用三角函數(shù)
網(wǎng)站URL:http://muchs.cn/article12/hgshdc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計公司、小程序開發(fā)、標(biāo)簽優(yōu)化、App開發(fā)、做網(wǎng)站、企業(yè)網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化