- /*
- *Copyright (c) 2015,烟台大学计算机学院
- *All rights reserved.
- *文件名称:text.cpp
- *作者:李德彪
- *完成日期:2015年3月9日
- *版本号:v1.0
- *
- *问题描述:成年男性的标准体重公式为:标准体重(kg)=身高(cm)-100,超标准体重20%为超重,
- * 比标准体重轻20%为超轻。请编写c++程序,输入身高和体重,计算出并输出标准体重,输出体重状态。
- *输入描述:两个整数,分别代表身高和体重
- *程序输出:一个整数,一句话,代表标准身高和体重状态
- */
- #include <iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int stdweight,height,weight;
- float low,high;
- cout<<"请输入身高:"<<endl;
- cin>>height;
- cout<<"请输入体重:"<<endl;
- cin>>weight;
- stdweight=height-100;
- low=stdweight*0.8;
- high=stdweight*1.2;
- cout<<"标准体重为:"<<stdweight<<endl;
- if(weight>high)
- {
- cout<<"超重"<<endl;
- }
- else if(weight<low)
- {
- cout<<"超轻"<<endl;
- }
- else
- cout<<"正常"<<endl;
- return 0;
- }
就拿胖子说事
最新推荐文章于 2020-12-24 09:07:10 发布