就拿胖子说事

/*
 * Copyright (c) 2016,烟台大学计算机与控制工程学院
 * All rights reserved.
 * 文件名称:app.cpp
 * 作    者:隋文涛
 * 完成日期:2016年3月9日
 * 版 本 号:v1.0
 *
 * 问题描述:成年男性的标准体重公式为:标准体重(kg)=身高(cm)-100,超标准体重20%为超重,比标准体重轻20%为超轻。输入身高体重,完成下面任务:
            (1)计算并输出标准体重。
            (2)计算出标准体重,当超重时给出提示,不超重时也给提示。
            (3)计算出标准体重,当超重时,请给出提示。
            (4)计算出标准体重,输出体重状态(正常/超重/超轻)
 * 输入描述:输入两个整数,分别代表身高(cm)和 体重(kg)
 * 程序输出:输出体重状态以及标准体重
 */
#include <iostream>
using namespace std;
int main()
{
    int height,bz;
    cout<<"请输入身高:";
    cin>> height ;
    bz = height-100;
    cout<<"标准体重:"<<bz<<endl;
    return 0;
}

#include <iostream>
using namespace std;
int main()
{
    int height,weight,bz;
    cout<<"请输入身高和体重:";
    cin>> height >> weight;
    bz = height-100;
    if(weight>1.2*bz)
    {
        cout <<"超重"<<endl;
    }
    else
    {
        cout <<"不超重"<<endl;
    }
    return 0;
}

#include <iostream>
using namespace std;
int main()
{
    int height,weight,tz;
    cout<<"请输入身高和体重:";
    cin>> height >> weight;
    tz = height-100;
    if(weight>1.2*tz)
        cout <<"超重"<<endl;
    return 0;
}

#include <iostream>
using namespace std;
int main()
{
    int height,weight,tz;
    cout<<"请输入身高和体重:";
    cin>> height >> weight;
    bz = height-100;
    if(weight>1.2*tz)
    {
        cout <<"超重"<<endl;
        cout <<"体重状态:超重"<<endl;
    }
    else
    {
        cout <<"不超重"<<endl;
        if(weight<0.8*tz)
            cout <<"体重状态:超轻"<<endl;
        else
            cout <<"体重状态:正常"<<endl;
    }
    return 0;
}

知识点总结:

        通过对程序的编程让我们更好地了解分支结构,有助于我们对编程的学习。

学习心得:

        我们编写程序时要注意规范。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值