(补)第一周 胖子伤不起

来源:互联网 发布:淘宝网模式 编辑:程序博客网 时间:2024/03/29 19:11
#include<iostream>using namespace std;struct Person{    char name[20];    char sex;  //'G'-女,'B'-男    double height;    double weight;};int main(){    double st, over;  //标准体重,超重比例    Person p;    cout<<"请分别输入姓名,性别(G女B男),身高,体重"<<endl;    cin>>p.name>>p.sex>>p.height>>p.weight;    if(p.sex=='G')        st=(p.height-70)*0.6;    else        st=(p.height-80)*0.7;    over=(p.weight-st)/st;    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
原创粉丝点击