
如何在C語(yǔ)言中解決正弦或余弦函數(shù)的表示方法我是一個(gè)?頭文件包含。math.h

站在用戶的角度思考問(wèn)題,與客戶深入溝通,找到本溪網(wǎng)站設(shè)計(jì)與本溪網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類型包括:網(wǎng)站建設(shè)、成都網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、空間域名、雅安服務(wù)器托管、企業(yè)郵箱。業(yè)務(wù)覆蓋本溪地區(qū)。
cos :余弦函數(shù)
函數(shù)原型:double cos(double x);
頭文件:#includemath.h
是否是標(biāo)準(zhǔn)函數(shù):是
函數(shù)功能:求x的余弦值,這里,x為弧度。
返回值:計(jì)算結(jié)果的雙精度值。
例程如下: 求cosx。
#include stdio.h
#include math.h
int main(void)
{
double result;
double x = M_PI。
小寫 cos 表示 余弦函數(shù),需頭文件 #include math.h
大寫 COS 沒有規(guī)定,你可以用來(lái)做變量名字或其它用途。
用法:
doublesin(doublex);
doublecos(doubley);
例:
#includestdio.h
#includemath.h
intmain()
{
intn;
doublet;
constdoublepi=4.0*atan(1.0);
scanf("%d",n);
t=(n*pi)*1.0/180;
printf("%lf\n",pi);
printf("%lf\n",sin(t));
擴(kuò)展資料
sinln等函數(shù),sin(pi/2)=1,ln1=0的使用
例:
#includemath.h
#includestdio.h
intmain()
{
doublepi=3.1416;
printf("sin(pi/2)=%f\nln1=%f\n",sin(pi/2),log(1.0));
return0;
}