/*
*Copyright (c) 2014,烟台大学计算机学院
*All rights reserved.
*文件名称:Annpion.cpp
*作者:王耀鹏
*完成日期:2014年12月19日
*版本号:v1.0
*
*问题描述:计算出体重情况。
*输入描述:输入一个人的姓名、性别、身高、体重。
*程序输出:输出体重情况。
*/
#include <iostream>
using namespace std;
struct person
{
char name[30];
char sex;
int height;
int weight;
};
int main()
{
person Person;
cout<<"input name,sex,height,weight"<<endl;
cin>>Person.name>>Person.sex>>Person.height>>Person.weight;
double standard;
if(Person.sex=='m')
{
standard=(Person.height-80)*0.7;
if(Person.weight<=1.1*standard&&Person.weight>=0.9*standard)
cout<<"我是高富帅!"<<endl;
else if(Person.weight>=0.8*standard&&Person.weight<0.9*standard)
cout<<"我要吃吃吃!"<<endl;
else if(Person.weight>1.1*standard&&Person.weight<=1.2*standard)
cout<<"我要减减减!"<<endl;
else if(Person.weight>1.2*standard)
cout<<"我不是胖子!T_T"<<endl;
else if(Person.weight<0.8*standard)
cout<<"我不是排骨精!T_T"<<endl;
else
{
standard=(Person.height-70)*0.6;
if(Person.weight<=1.1*standard&&Person.weight>=0.9*standard)
cout<<"我是白富美!"<<endl;
else if(Person.weight>=0.8*standard&&Person.weight<0.9*standard)
cout<<"我要吃吃吃!"<<endl;
else if(Person.weight>1.1*standard&&Person.weight<=1.2*standard)
cout<<"我要减减减!"<<endl;
else if(Person.weight>1.2*standard)
cout<<"我不是胖子!T_T"<<endl;
else if (Person.weight<0.8*standard)
cout<<"我不是排骨精!T_T"<<endl;
return 0;
}
}
return 0;
}
运行结果: