1-2-标准体重问题

01./*  
02.* 程序的版权和版本声明部分:  
03.* Copyright (c) 2011, 烟台大学计算机学院  
04.* All rights reserved.  
05.* 文件名称:test.cpp  
06.* 作    者:刘芳
07.* 完成日期:2014 年03 月02  日  
08.* 版 本 号:v1.0  
09.* 对任务及求解方法的描述部分: 
10.* 输入描述:无  
11.* 问题描述: 
12.* 程序输出: 
13.* 问题分析:略 
14.* 算法设计:略  
15.*/    




#include <iostream>
//#include<cstring>
#include<cstdio>
using namespace std;
struct  Student
{
    char  name;
    char  sex;
    double  height;
    double  weight;
};

void  Biaozhen(Student);

int main()
{
    Student  student;

    cout<<"请输入学生的姓名,性别(M代表男。W代表女),身高,体重:"<<endl;
    cin>>student.name>>student.sex>>student.height>>student.weight;
    Biaozhen(student);
    return 0;
}
void  Biaozhen(Student student)
{

    double standard;

    if(student.sex=='M')
   {
       standard=(student.height-80)*0.7;


{

         if( standard*0.9>=student.weight&& standard*1.1<=student.weight)
         cout<<"恭喜!该同学的体重为正常体重"<<endl;
         else if( standard*0.8<=student.weight&&standard*0.9>=student.weight)
         cout<<"该同学的体重过轻,请注意饮食"<<endl;
         else if(standard*0.8>=student.weight)
         cout<<"该同学的体重不足,请注意饮食"<<endl;
        else if(standard*1.1<=student.weight&&standard*1.2>=student.weight)
           cout<<"该同学的体重过重,请注意饮食"<<endl;
           else if(standard*1.2<=student.weight)
           cout<<"该同学的体重为肥胖,请注意饮食"<<endl;
       }

}else
{
     standard=(student.height-70)*0.6;
    {

         if( standard*0.9>=student.weight&& standard*1.1<=student.weight)
         cout<<"恭喜!该同学的体重为正常体重"<<endl;
         else if( standard*0.8<=student.weight&&standard*0.9>=student.weight)
         cout<<"该同学的体重过轻,请注意饮食"<<endl;
         else if(standard*0.8>=student.weight)
         cout<<"该同学的体重不足,请注意饮食"<<endl;
        else if(standard*1.1<=student.weight&&standard*1.2>=student.weight)
           cout<<"该同学的体重过重,请注意饮食"<<endl;
           else if(standard*1.2<=student.weight)
           cout<<"该同学的体重为肥胖,请注意饮食"<<endl;
       }



}
}
多次修改,换用了方法,最后有崩溃的感觉,坚持!!!!!!!!!!!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值