肥胖问题 法二

/*
* Copyright (c) 2014, 烟台大学计算机学院
* All rights reserved.
* 作    者:王颖
* 完成日期:2014 年 3 月 2 日
* 版 本 号:v1.0
* 输入描述: 无
* 问题描述:肥胖问题
* 程序输出:略
* 问题分析:略
* 算法设计:略
*/
#include <iostream>

using namespace std;

struct People
{
char name[6];
char nex;//M男,W女防止乱码!!!!!
double height;
double weight;
};
void output(char [6],char ,double ,double);//void output(char ,char ,double ,double);靠靠靠!!!之前是这么写的,结果错了!!
int main()
{
    People peo;
   cout<<"please into name,nex(男的W女的M),height,weight:"<<endl;
   cin>>peo.name>>peo.nex;
   while(peo.nex!='M'&&peo.nex!='W')
   {
       cout<<"请重新输入:"<<endl;
       cin>>peo.nex;
   }
   cin>>peo.height>>peo.weight;
   output(peo.name,peo.nex,peo.height,peo.weight);
    return 0;
}
void output(char name[6],char nex,double height,double weight)
{
    double t=0,s=0;
    if(nex=='W')
    {
      t=(height-80)*0.7;
    }
     else
     {
         t=(height-80)*0.6;
     }
        s=(weight-t)/t;
        if(s>-0.1)
    {
        cout<<name[6]<<"太帅啦!恭喜您!您的体重为标准体重!!"<<endl;
    }
    else if(s>0.1)
    {
        cout<<name[6]<<"您的体重过重,注意减肥啦!"<<endl;
    }
    else if(s>-0.2)
    {
        cout<<name[6]<<"您的体重过轻,平时要多吃点啦"<<endl;
    }
    else if(s>0.2)
    {
        cout<<name[6]<<"啊偶~您太注意减肥了,体重不足对您的身体可不好呦!"<<endl;
    }
    else
    {
        cout<<name[6]<<"能不能干啦?!!!吃那么多!太肥胖啦小心生病!"<<endl;
    }
}

心得体会:哎呀!!!可算是找着问题了啊!!!!!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值