#include <math.h>
double a = atan(1.0)*180/3.1415926
double b = atan(0.0)*180/3.1415926
double c = atan(-1.0)*180/3.1415926
计算结果
a=45
b=0
c=-45
atan2更加的好用;
atan2函数的功能是计算Y/X的反正切值, 其用法为double atan2(double y, double x)程序实例代码如下:
#include <stdio.h>
#include <math.h>
int main(void)
{
double result
double x = 90.0, y = 45.0
result = atan2(y, x)
printf("The arc tangent ratio of %lf is %lf\n", (y / x), result)
return 0
}
atan2应该是一个函数,把你上下文贴出来才能更好的给你解释(Y1-Y2)是它的第一个参数,(X1-X2)是第二个参数
百科里面有
http://baike.baidu.com/view/653928.htm