第十七周项目3——胖子伤不起

/*
 *Copyright(c)2014,烟台大学计算机学院
 *All rights reserved.
 *文件名称:test.cpp
 *作者:李晓凯
 *完成日期:2014年 12月 20 日
 *版本号:v1.0
 *
 *问题描述:计算判断并输出一个人的体重情况
 *程序输入:输入姓名、性别、身高(cm)、体重(kg)

 *程序输出:输出体重情况

 */

#include <iostream>

using namespace std;
struct person
{
    char name[20];
    char sex;
    double height;
    double weight;
};
int main()
{
    person a;
    int n;
    double standard_weight,overweight;
    cin>>a.name>>a.sex>>a.height>>a.weight;
    if(a.sex=='m'||a.sex=='M')
        standard_weight=(a.height-80)*0.7;
    if(a.sex=='w'||a.sex=='W')
        standard_weight=(a.height-70)*0.6;
    n=standard_weight;
    overweight=(a.weight-standard_weight)/standard_weight;
    if(a.weight>n*0.9&&a.weight<n*1.1)
        cout<<"亲,身材不错啊,继续保持!"<<endl;
    else if(a.weight>n*0.8&&a.weight<n*0.9)
        cout<<"亲,再增重那么一点点就完美了!"<<endl;
    else if(a.weight>n*1.1&&a.weight<n*1.2)
        cout<<"亲,再减轻那么一点点就完美了!"<<endl;
    else if(a.weight<n*0.8)
        cout<<"亲,你看看你那细胳膊细腿,多可怜啊!多吃点吧!"<<endl;
    else if(a.weight>n*1.2)
        cout<<"亲,你都属于肥胖阶段的了,该减减了!"<<endl;
    cout<<"亲,你超重了:"<<overweight*100<<"%"<<endl;
    return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值