一.2

来源:互联网 发布:淘宝抢购怎样抢的快 编辑:程序博客网 时间:2024/05/16 12:55
/*烟台大学计算机学院学生*All rights reserved.*文件名称:胖子伤不起*作者:CXZ*完成日期:2013年3月3日*版本号:v1.0*对任务及求解方法的描述部分:胖子伤不起*我的程序:*/#include <iostream>using namespace std;struct Person{    char sex;    char name[20];    double height;    double weight;};int main(){    double standard,over;    Person p;//这一步很重要,在这里栽了个跟头    cout<<"请依次输入 性别(m(男)w(女))姓名 身高 体重"<<endl;    cin>>p.sex>>p.name>>p.height>>p.weight;    if(p.sex=='m')//只能是一个字母,不能用一个英语单词    {        standard=(p.height-80)*0.7;    }    else    {        standard=(p.height-70)*0.6;    }    over=(p.weight-standard)/standard;    if(over>0.2)        cout<<"再不控制饮食就爆表了!"<<endl;    else if(over>0.1)        cout<<"有一点小胖哦!"<<endl;    else if(over>-0.1)        cout<<"标准身材,继续保持!"<<endl;    else if(over>-0.2)        cout<<"太苗条了!"<<endl;    else        cout<<"体重太轻,加油哦!"<<endl;    return 0;}

成果展示:
心得体会:怎么调整自己状态啊

 

0 0