第二周项目二———就拿胖子说事
2016-03-09 13:14
176 查看
/*copyright(c)2016.烟台大学计算机学院 02. * All rights reserved, 03. * 文件名称:weight.cpp 04. * 作者:吴敬超 05. * 完成日期:2016年3月8日 06. * 版本号:vc++6.0 07. * 08. * 问题描述:输入体重,身高,求出标准体重 09. * 输入描述: 输入两个变量 10. * 程序输出:输出标准体重 11. */ 12.#include<iostream> 13.using namespace std; 14.int main() 15.{ 16. float weight,height,standard_weight;// 定义三个变量,体重,身高,标准体重 17. cin>>height>>weight; 18. standard_weight=height-weight; 19. cout<<standard_weight<<endl; 20. return 0; 21.}
(2)<pre class="cpp" name="code">/*copyright(c)2016.烟台大学计算机学院 02. * All rights reserved, 03. * 文件名称:weight.cpp 04. * 作者:吴敬超 05. * 完成日期:2016年3月8日 06. * 版本号:vc++6.0 07. * 08. * 问题描述:输入体重,身高,求出标准体重 09. * 输入描述: 输入两个变量 10. * 程序输出:输出提示 11. */ 12.#include<iostream> 13.using namespace std; 14.int main() 15.{ 16. float weight,height,standard_weight;// 定义三个变量,体重,身高,标准体重 17. cin>>height>>weight; 18. standard_weight=height-weight; //求出标准体重 19. if(weight>standard_weight*(1.2)) 20. { 21. cout<<"您已超重"<<endl; 22. } 23. return 0; 24.}
(3)<pre class="cpp" name="code">/*copyright(c)2016.烟台大学计算机学院 02. * All rights reserved, 03. * 文件名称:weight.cpp 04. * 作者:吴敬超 05. * 完成日期:2016年3月8日 06. * 版本号:vc++6.0 07. * 08. * 问题描述:输入体重,身高,求出标准体重 09. * 输入描述: 输入两个变量 10. * 程序输出:输出提示 11. */ 12.#include<iostream> 13.using namespace std; 14.int main() 15.{ 16. float weight,height,standard_weight;// 定义三个变量,体重,身高,标准体重 17. cin>>height>>weight; 18. standard_weight=height-weight; //求出标准体重 19. if(weight>standard_weight*(1.2)) 20. { 21. cout<<"您已超重"<<endl; 22. } 23. else 24. { 25. cout<<"您不超重"<<endl; 26. } 27. return 0; 28.}
(4)<pre class="cpp" name="code">/*copyright(c)2016.烟台大学计算机学院 02. * All rights reserved, 03. * 文件名称:weight.cpp 04. * 作者:吴敬超 05. * 完成日期:2016年3月8日 06. * 版本号:vc++6.0 07. * 08. * 问题描述:输入体重,身高,求出标准体重 09. * 输入描述: 输入两个变量 10. * 程序输出:输出提示 11. */ 12.#include<iostream> 13.using namespace std; 14.int main() 15.{ 16. float weight,height,standard_weight;// 定义三个变量,体重,身高,标准体重 17. cin>>height>>weight; 18. standard_weight=height-weight; //求出标准体重 19. if(weight>standard_weight*(1.2)) 20. { 21. cout<<"您已超重"<<endl; 22. } 23. else if(weight<standard_weight*(0.8)) 24. { 25. cout<<"您超轻"<<endl; 26. } 27. else 28. { 29. cout<<"正常"<<endl; 30. } 31. return 0; 32.}
运行结果:
相关文章推荐
- jquery 验证注册的代码
- 搞好团队建设的致胜法宝
- 【Training Contest】2016.03.08
- linux awk命令详解
- Jquery的img附加在UL下以及img附加在div下
- 【SSH进阶之路】一步步重构容器实现Spring框架——彻底封装,实现简单灵活的Spring框架(十一)
- 美国为什么刑事犯罪率是中国的几十倍?
- ios 计算月数、周数、天数
- 理解smart pointer之一(auto_ptr介绍)
- auto_ptr 代码及缺陷
- shiro url和过滤器处理功能
- Lua -- MacOS上安装lua
- DOM和BOM的区别
- xargs用法详解(转载)
- hdu 2035人见人爱A^B
- 【SSH进阶之路】一步步重构容器实现Spring框架——配置文件+反射实现IoC容器(十)
- PHP常用缓存技术?
- Linux -- Solr 安装/配置
- Ceph蹚坑笔记 - (4)
- 48-题目1438:最小公倍数