1周项目2

来源:互联网 发布:linux虚拟机怎么分区 编辑:程序博客网 时间:2024/06/03 06:50
/* * 程序的版权和版本声明部分 * Copyright (c)2013, 烟台大学计算机学院学生 * All righ. * 文件名称: xi.cpp * 作    者:席翱翔 * 完成日期:2014年3月5日 * 版本号: v1.0 * * 输入描述: * 问题描述:* 程序输出: * 问题分析: */  #include <iostream>using namespace std;struct Person{    char name[10];    char sex;//V为女,M为男。    double height;    double weight;};int main(){    double bz,cz;//bz标准体重,cz超重体重。    Person a;    cin>>a.name>>a.sex>>a.height>>a.weight;    if(a.sex=='v')        bz=(a.height-70)*0.6;    else        bz=(a.height-80)*0.7;    cz=(a.weight-bz)/bz;    if(cz>0.2)        cout<<"您达到了,,,,,"<<endl;    else if (cz>0.1)        cout<<"有些重了"<<endl;    else if (cz>-0.1)        cout<<"好,您让人羡慕"<<endl;    else if (cz>-0.2)        cout<<"再能重点就更好了"<<endl;    else        cout<<"太轻了,注意营养"<<endl;   return 0;}

结果:
0 0
原创粉丝点击