这个哪里有错误
/* Program 2.17 Calculating the height of a tree */#include <stdio.h>
int main(void)
{
long shorty =0L; // Shorty's height in inches 矮子的英寸高度
long lofty =0L; // Lofty's height in inches 高个子的英寸高度
long feet =0L;
long inches =0L;
long shorty_to_lofty =0L; // Distance from Shorty to Lofty in inches 矮子和高个子的英寸差距
long lofty_to_tree =0L; // Distance from Lofty to the tree in inches 高个子到树的英寸差距
long tree_height =0L; // Height of the tree in inches 树的高度英寸
const long inches_per_foot =12L;
// Get Lofty's height 高个子的身高
printf("Enter Lofty's height to the top of his/her head, in whole feet: ");
scanf("%Ld", &feet);
printf(" ...and then inches: ");
scanf("%Ld", &inches);
lofty = feet*inches_per_foot + inches;
// Get Shorty's height up to his/her eyes //矮子的身高到他的眼睛距离
printf("Enter Shorty's height up to his/her eyes, in whole feet: ");
scanf("%Ld", &feet);
printf(" ... and then inches: ");
scanf("%Ld", &inches);
shorty = feet*inches_per_foot + inches;
// Get the distance from Shorty to Lofty //高个子和矮子的距离
printf("Enter the distance between Shorty and Lofty, in whole feet: ");
scanf("%Ld", &feet)"
printf(" ... and then inches:");
scanf("%Ld", &inches);
shorty_to_lofty = feet*inches_per_foot + inches;
// Get the distance from Lofty to the tree //高个子到树的距离
printf("Finally enter the distance from Lofty to the tree to the nearest foot: ");
scanf("%Ld", &feet);
Lofty_to_tree = feet*inches_per_foot;
// Calculate the height of the tree in inches //在英寸计算树的高度
tree_height = shorty+(shorty_to_lofty + lofty_to_tree)*(lofty-shorty)/
shorty_to_lofty;
// Display the result in feet and inches //英尺和英寸的显示结果
printf("The height of the tree is %Ld feet and %Ld inches.\n",
tree_height/inches_per_foot,tree_height% inches_per_foot);
return 0;
}
这个是教学书里的,比对了,没发现输入错误,但是我执行的时候就提示出错
图片是错误信息,麻烦老师指出