2 回答

TA貢獻(xiàn)1757條經(jīng)驗(yàn) 獲得超8個(gè)贊
要用弧度計(jì)算的,另外,pintf語句中,應(yīng)該是"%lf",不是"f%"
sin()是三角函數(shù),參數(shù)使用的是弧度,不是度。
asin()才是反三角函數(shù)。
資料 :
NAME
asin, asinf, asinl - arc sine function
SYNOPSIS
#include <math.h>
double asin(double x);
float asinf(float x);
long double asinl(long double x);
Link with -lm.
DESCRIPTION
The asin() function calculates the arc sine of x; that is the value
whose sine is x. If x falls outside the range -1 to 1, asin() fails
and errno is set.
RETURN VALUE
The asin() function returns the arc sine in radians and the value is
mathematically defined to be between -PI/2 and PI/2 (inclusive).

TA貢獻(xiàn)1851條經(jīng)驗(yàn) 獲得超5個(gè)贊
幫你更正一下:
int main()
{
const double pi=3.14; //定義pi的值
double a;
a=sin(45*pi/180); //角度轉(zhuǎn)化為弧度
printf("%f",a); //printf的正確格式
}
- 2 回答
- 0 關(guān)注
- 203 瀏覽
添加回答
舉報(bào)