胖子伤不起

/*  
*Copyright (c) 2013 ,烟台大学计算机学院  
*All rights reserved.  
*作者:王至超  
*完成日期:2014年03月02
*版本号:v1.0  
*问题描述:体重对于胖子和瘦子都伤不起  
*样例输入: 
*样例输出: 
*问题分析:用简单的方法,学会活学活用  
*/  
#include <iostream>
using namespace std;
struct People
{
    char name[20];
    char sex;
    double height;
    double weight;

}people;
int main()
{

    double str,overweight;
   cout<<"请输入一个人的姓名,性别,身高,体重"<<endl;
   cin>>people.name>>people.sex>>people.height>>people.weight;
   if(people.sex=='f')
        str=(people.height-80)*0.7;

   if(people.sex=='m')

    str=(people.height-70)*0.6;

   overweight=(people.weight-str)/str;
   if(overweight<0.1&&overweight>0||overweight<0&&overweight>-0.1)
    cout<<"你的体重为正常体重"<<endl;
   else if(overweight<0.2&&overweight>0.1)
    cout<<"你的体重处于过重状态,请你适当运动,来保持身材"<<endl;

    else if(overweight<-0.1&&overweight>-0.2)
    cout<<"你的体重处于过轻状态,请你加强营养"<<endl;
    else if(overweight>0.2)
    cout<<"你已处于肥胖状态状态,请你尽全力减肥"<<endl;
    else
    cout<<"你已处于体重不足状态,请你尽量增肥"<<endl;
    return 0;
}
胖子伤不起_第1张图片

你可能感兴趣的:(胖子伤不起)