关于三角函数、反三角函数在VC和linux gcc下的编译

写法:

1.都要包含 <math.h>

2.三角函数,比如计算sin(30),应写

double  a;

a = sin(30 * 3.1415926 /180);

3.反三角函数,比如arctan(1),应写

double  b;

b = atan(1) * 180 / 3.1415926;

在linux下,用gcc编译,最后要加 -lm ,比如:

gcc test.c -lm

猜你喜欢

转载自blog.csdn.net/yaodaoji/article/details/70214916