求一个行业使用小程序的写法
请输入真倾角a请输入倾向b
请输入剖面方位c
夹角d=绝对值(c-b)
如果夹角d>90度,则等于夹角d—90度
如果夹角d<90度,则等于夹角d
tan(视倾角)=tan(真倾角a)*cos(夹角d)
求视倾角等于?
程序代码:#include <stdio.h>
#include <math.h>
int main(void)
{
double a = 0.0;
double b = 0.0;
double c = 0.0;
double d = 0.0;
printf("真倾角a(degree): ");
scanf("%lf", &a);
printf("倾向b(degree): ");
scanf("%lf", &b);
printf("剖面方位c(degree): ");
scanf("%lf", &c);
d = fabs(c - b);
#define PI (3.1415926535897932)
a = a / 180.0 * PI;
d = (d>90?d-90:d)/180.0*PI;
printf("\n视倾角(degree): %lf", atan(tan(a) * cos(d))*180.0/PI);
#undef PI
return 0;
}