第一周项目2 胖子伤不起
2014-03-06 19:08
267 查看
/* *Copyright (c)2013,烟台大学计算机学院 *All rights reserved. *文件名称:test.cpp *作者:孙玲倩 *完成日期:2014年3月6日 *版本号:v1.0 *输入描述:无 *问题描述:按照公式计算人的体重是否标准 */ #include <iostream> using namespace std; struct Student { char name [18]; char sex;//男m/M,女w/W double height; double weight; }; int main() { Student student; double bw,ow; cout<<"请输入姓名,性别,身高,体重:"<<endl; cin>>student.name>>student.sex>>student.height>>student.weight; if (student.sex='w') { bw=(student.height-70)*0.6; } else { bw=(student.height-80)*0.7; } ow=(student.weight-bw)/bw; if(ow >-0.1) { cout<<"恭喜您,您的体重很标准哦!继续保持哦!"<<endl; } else if(ow >-0.2) { cout <<"亲,您有点瘦哦,注意保持营养啊!"<<endl; } else if(ow >0.1) { cout <<"亲,有点胖了,注意均衡饮食,保持身体健康哦!"<<endl; } else if (ow>0.2) { cout <<"亲,太胖了。该减肥了哦!"<<endl; } else { cout <<"亲,太瘦了!多吃点吧!"<<endl; } return 0; }
心得体会:自己一开始写的可以运行但是不太符合标准,经过参考修改终于达标了!
相关文章推荐
- iOS开发 如何检查内存泄漏
- ios隐藏电池条
- 有序的结构体数组
- 裁剪测试Linux启动流程
- 简易的java上传商品的程序
- android线程机制
- ubuntu 12.04 安装eclipse
- J2SE J2EE J2ME的区别 以及 MVC与SSH对应关系
- 实现自己的脚本语言ngscript之二:语法分析
- 关于win32的文章链接
- Spring MVC概述---15.1.2: 配置DispatcherServlet
- linux不能不记住的查找命令
- 16进制的简单运算
- Spring MVC概述---15.1.1: 体系结构
- 挂载点的对数据存储作用
- 机器人
- sublime Text与markdown、hlsl、graphviz
- [方法] Windows 下SSH远程连接Linux
- OSI
- ---------学生信息管理系统----------