#includestdio.h

潁泉網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),潁泉網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為潁泉上1000+提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站制作要多少錢,請找那個售后服務(wù)好的潁泉做網(wǎng)站的公司定做!
#include math.h
void main()
{
double a,b,c,d;
scanf("%f,%f",b,d);
a=sin(b);/*這是三角函數(shù)*/
c=asin(d);/*這是反三角函數(shù)*/
printf("sin(b)=%f,asin(d)=%d",a,c);
}
其他三角函數(shù)如cos(x)什么的,可以直接用,前提有math.h的頭文件
1.需要包含頭文件#includemath.h
2.使用角度計算時需要先轉(zhuǎn)換為弧度值
3.pi,獲取pi的值,這里用到了acos,反余弦函數(shù),值域是0-pi,取值范圍是-1到1
Ps:反余弦沒學(xué)過,百度上搜的
#include stdio.h
#include math.h
double toAngle(int);
//測試值
int angle = 30;
int main()
{
double p = sin (? toAngle( angle) );
printf(" sin : %d = %f" , angle ,p);
}
//將角度轉(zhuǎn)為弧度
double toAngle(int angle)
{
//求pi,3.141593
double pi = acos(-1);
printf(" get pi : %f\n",pi);
return angle* pi/180;
}
acos( ) 的形參當(dāng)然有范圍,-1,至1,閉區(qū)間,基本的數(shù)學(xué)知識,如果朝界控制臺會顯示-1.#IND,表示數(shù)據(jù)超界;關(guān)于坐標(biāo)的函數(shù)當(dāng)然有,需要用到結(jié)構(gòu)體COORD,以及頭文件windows.h 具體代碼如下:
#include windows.h
#include stdio.h
void gotoxy(int x,int y)
{
COORD coord;
coord.X=x;
coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
void main()
{
gotoxy(50,60);
printf("I LOVE YOU");
}
這個程序就實現(xiàn)了移動光標(biāo)到指定位置,然后輸出指定的內(nèi)容。
名稱欄目:c語言acos函數(shù)實現(xiàn) c語言arccos函數(shù)
文章URL:http://chinadenli.net/article46/dojooeg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營銷型網(wǎng)站建設(shè)、電子商務(wù)、微信小程序、響應(yīng)式網(wǎng)站、標(biāo)簽優(yōu)化、全網(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)