您的位置:首页 > 其它

就拿胖子说事

2016-03-09 22:13 295 查看
/*
* Copyright (c) 2016,烟台大学计算机与控制工程学院
* All rights reserved.
* 文件名称:app.cpp
* 作    者:隋文涛
* 完成日期:2016年3月9日
* 版 本 号:v1.0
*
* 问题描述:成年男性的标准体重公式为:标准体重(kg)=身高(cm)-100,超标准体重20%为超重,比标准体重轻20%为超轻。输入身高体重,完成下面任务:
(1)计算并输出标准体重。
(2)计算出标准体重,当超重时给出提示,不超重时也给提示。
(3)计算出标准体重,当超重时,请给出提示。
(4)计算出标准体重,输出体重状态(正常/超重/超轻)
* 输入描述:输入两个整数,分别代表身高(cm)和 体重(kg)
* 程序输出:输出体重状态以及标准体重
*/
#include <iostream>
using namespace std;
int main()
{
int height,bz;
cout<<"请输入身高:";
cin>> height ;
bz = height-100;
cout<<"标准体重:"<<bz<<endl;
return 0;
}




#include <iostream>
using namespace std;
int main()
{
int height,weight,bz;
cout<<"请输入身高和体重:";
cin>> height >> weight;
bz = height-100;
if(weight>1.2*bz)
{
cout <<"超重"<<endl;
}
else
{
cout <<"不超重"<<endl;
}
return 0;
}



#include <iostream>
using namespace std;
int main()
{
int height,weight,tz;
cout<<"请输入身高和体重:";
cin>> height >> weight;
tz = height-100;
if(weight>1.2*tz)
cout <<"超重"<<endl;
return 0;
}



#include <iostream>
using namespace std;
int main()
{
int height,weight,tz;
cout<<"请输入身高和体重:";
cin>> height >> weight;
bz = height-100;
if(weight>1.2*tz)
{
cout <<"超重"<<endl;
cout <<"体重状态:超重"<<endl;
}
else
{
cout <<"不超重"<<endl;
if(weight<0.8*tz)
cout <<"体重状态:超轻"<<endl;
else
cout <<"体重状态:正常"<<endl;
}
return 0;
}




知识点总结:

通过对程序的编程让我们更好地了解分支结构,有助于我们对编程的学习。

学习心得:

我们编写程序时要注意规范。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: