入门学习时遇到的问题 帮忙看一下怎么回事!
这是一个求树的高度的题其中xiaosanjiaobili 得出的结果老是是零
导致shudegaodu的结果不准确
为什么?
#include <stdio.h>
int main (void)
{
long Ayandegaodu =0L;
long Bdegaodu = 0L;
long A_Bdejuli = 0L;
long B_SHUdejuli = 0L;
float shudegaodu =0.0f;
long A_SHUdejuli=0;
long xiaoBgaodu =0;
float xiaosanjiaobizhi = 0.0f;
float xiaoshudegaodu= 0.0f;
printf("请输入A到眼睛的高度\n");
scanf("%ld",&Ayandegaodu);
printf("请输入B的高度\n");
scanf("%ld",&Bdegaodu);
printf("请输入A到B得距离\n");
scanf("%ld",&A_Bdejuli);
printf("请输入B到树的距离\n");
scanf("%ld",&B_SHUdejuli);
xiaoBgaodu =( Bdegaodu - Ayandegaodu;
xiaosanjiaobizhi =xiaoBgaodu / A_Bdejuli;
A_SHUdejuli=A_Bdejuli + B_SHUdejuli;
xiaoshudegaodu=xiaosanjiaobizhi * A_SHUdejuli;
shudegaodu= (xiaoshudegaodu + Ayandegaodu;
printf("树的高度为 %ld", Ayandegaodu);
return 0;
}