第一周上机实践项目——胖子伤不起
2014-03-01 10:58
274 查看
01./* 02.*程序的版权和版本声明部分: 03.*Copyright(c)2013,烟台大学计算机学院学生 04.*All rights reserved. 05.*文件名称: 06.*作者:刘中林 07.*完成日期:2013年 03月01日 08.*版本号:v0.1 09.*对任务及求解方法的描述部分:题意 10.*输入描述:输入姓名、性别、体重、身高 11.*问题描述: 12.*程序输出:体重状况 13.*问题分析:男女标准的不同 14.*算法设计:standard1=(People1.height-80)*0.7;standard2=(People1.height-70)*0.6; 15.*/ 16.*我的程序: #include <iostream> #include <string> using namespace std; struct People { string name; char sex; double weight; double height; }; int main() { string s; People People1; double standard,overweight; cout<<"姓名:"<<endl; cin>>People1.name; cout<<"性别:"<<endl; cin>>People1.sex; cout<<"身高:"<<endl; cin>>People1.height; cout<<"体重:"<<endl; cin>>People1.weight; if(People1.sex=='m') { standard=(People1.height-80)*0.7; } else if(People1.sex=='w') { standard=(People1.height-70)*0.6; } overweight=(People1.weight-standard)/(standard); if((overweight<=0.1&&overweight>=0)||(overweight>=-0.1&&overweight<=0)) { cout<<"正常"<<endl; }else if(overweight>-0.2&&overweight<-0.1) { cout<<"过轻"<<endl; }else if(overweight<=0.2&&overweight>=0.1) { cout<<"过重"<<endl; }else if(overweight>0.2) { cout<<"肥胖"<<endl; }else { cout<<"体重不足"<<endl; } return 0; }
*样例输出:
*心得体会:这一局快弄毁俺了。。
相关文章推荐
- java获取前一天,一周,一个月的时间区间
- PHP代码优化 成员变量获取速度对比
- javascript传参字符串 与引号的嵌套调用
- 算术运算符
- spring3.1缓存详解
- C++编译器与链接器工作原理
- 判断是否是通过手机访问
- jquery获取不到图片的高度 需要在window.onload=function后才能获取到
- ffmpeg avformat_open_input详解
- C++中的前置声明
- HDU 2768
- TTL与CMOS的区别
- Gwt 整合FusionCharts及封装搜狗地图时出现的问题
- Java网页数据采集器[下篇-数据查询]【转载】
- AppleScript学习笔记(六)处理程序Handler
- 计算sdcard上的剩余空间
- Linux——标准目录结构
- equals()方法和==的比较
- chrome调试js
- php递归实现无限分类生成下拉列表