| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 786 人关注过本帖
标题:我想知道这个代码哪里做了,谢谢。
取消只看楼主 加入收藏
编程初学
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2016-3-19
结帖率:0
收藏
已结贴  问题点数:20 回复次数:0 
我想知道这个代码哪里做了,谢谢。
/* Pragram 2.18 Calculating the heighe of a there */
#include <stdio.h>

int main(void)
{
    long shorty = 0L;                                             // 矮子在英寸的高度
    long lofty = 0L;                                               // 左边在英寸的高度
    long feet = 0L;
    long inches = 0L;
    long shorty_to_lofty = 0L;                                     // 矮个子到高个子的距离
    long lofty_to_tree = 0L;                                       // 高个子到树的距离
    long tree_height = 0L;                                          // hight of the in inchies
    const long inches_per_foot = 12L;
   
    // Get Lofty's height
    printf("Enter Lofty's hight 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
    ptintf("Enter Shorty's heinght up to his/her eyes, in whole feet: ");
    scanf("%ld", &feet);
    printf("                                         ... and there inches: ");
    scanf("%ld", &inches);
    shorty = feet*inches_per_foot + inches;
   
    // Gat 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 thes 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 incher
    tree_height = shorty + (shorty_to_lofty + lofty_to_tree)*(lofty-shorty)/shorty_to_lofty;
   
    // Dispiay 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;
搜索更多相关主题的帖子: 矮个子 include 高个子 
2016-03-19 23:58
快速回复:我想知道这个代码哪里做了,谢谢。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.033908 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved