第二周上机实践项目——项目2-就拿胖子说事
2016-03-10 08:46
204 查看
/*
*Copyright(c) 2016, 烟台大学计算机与控制工程学院
*All rights reserved.
*文件名称:high and weight.cpp
*作 者:郑志金
*完成日期:2016年3月10日
*版本号:v1.0
*
*问题描述:输入身高和体重,给出标准体重公式,完成下列任务:
(1)计算并输出标准体重。
(2)计算出标准体重,当超重时,请给出提示。
(3)计算出标准体重,当超重时给出提示,不超重时也给出提示。
(4)计算出标准体重,输出体重状态(正常/超重/超轻)。
*输入描述:输入身高和体重
*输出描述:输出标准体重和体重状态
*/
(1)
#include<iostream>
using namespace std;
int main()
{
int high,weight;
cout<<"请输入当前身高:";
cin>>high;
weight=high-100;
cout<<"标准体重为:"<<weight<<"kg"<<endl;
return 0;
}
运行结果:
(2)
#include<iostream>
using namespace std;
int main()
{
int high,weight,weight1;
cout<<"请输入当前身高:";
cin>>high;
cout<<"请输入当前体重:";
cin>>weight;
weight1=high-100;
if(weight>weight1)
cout<<"超重"<<endl;
return 0;
}
运行结果:
(3)
#include<iostream>
using namespace std;
int main()
{
int high,weight,weight1;
cout<<"请输入当前身高:";
cin>>high;
cout<<"请输入当前体重:";
cin>>weight;
weight1=high-100;
if(weight>weight1)
cout<<"超重"<<endl;
else
cout<<"不超重"<<endl;
return 0;
}
运行结果:
(4)
#include<iostream>
using namespace std;
int main()
{
int high,weight,weight1;
cout<<"请输入当前身高:";
cin>>high;
cout<<"请输入当前体重:";
cin>>weight;
weight1=high-100;
if(weight>weight1)
cout<<"超重"<<endl;
if(weight<weight1)
cout<<"超轻"<<endl;
if(weight==weight1)
cout<<"正常"<<endl;
return 0;
}
运行结果:
知识点总结:
清楚了发布博文的格式,更加规范了程序。
*Copyright(c) 2016, 烟台大学计算机与控制工程学院
*All rights reserved.
*文件名称:high and weight.cpp
*作 者:郑志金
*完成日期:2016年3月10日
*版本号:v1.0
*
*问题描述:输入身高和体重,给出标准体重公式,完成下列任务:
(1)计算并输出标准体重。
(2)计算出标准体重,当超重时,请给出提示。
(3)计算出标准体重,当超重时给出提示,不超重时也给出提示。
(4)计算出标准体重,输出体重状态(正常/超重/超轻)。
*输入描述:输入身高和体重
*输出描述:输出标准体重和体重状态
*/
(1)
#include<iostream>
using namespace std;
int main()
{
int high,weight;
cout<<"请输入当前身高:";
cin>>high;
weight=high-100;
cout<<"标准体重为:"<<weight<<"kg"<<endl;
return 0;
}
运行结果:
(2)
#include<iostream>
using namespace std;
int main()
{
int high,weight,weight1;
cout<<"请输入当前身高:";
cin>>high;
cout<<"请输入当前体重:";
cin>>weight;
weight1=high-100;
if(weight>weight1)
cout<<"超重"<<endl;
return 0;
}
运行结果:
(3)
#include<iostream>
using namespace std;
int main()
{
int high,weight,weight1;
cout<<"请输入当前身高:";
cin>>high;
cout<<"请输入当前体重:";
cin>>weight;
weight1=high-100;
if(weight>weight1)
cout<<"超重"<<endl;
else
cout<<"不超重"<<endl;
return 0;
}
运行结果:
(4)
#include<iostream>
using namespace std;
int main()
{
int high,weight,weight1;
cout<<"请输入当前身高:";
cin>>high;
cout<<"请输入当前体重:";
cin>>weight;
weight1=high-100;
if(weight>weight1)
cout<<"超重"<<endl;
if(weight<weight1)
cout<<"超轻"<<endl;
if(weight==weight1)
cout<<"正常"<<endl;
return 0;
}
运行结果:
知识点总结:
清楚了发布博文的格式,更加规范了程序。
相关文章推荐
- 上机报告
- Java多线程基础:进程和线程之由来
- android: 创建自己的内容提供器
- 动态规划求最大子序列
- javascript动画:velocity.js学习
- 第二周项目:输入一句话
- 第二周项1-宣告“主权”
- 第二周项目2-别拿胖子说事
- 第二周项目三--小试循环
- 自学 java 笔记 day12(多线程)
- Redis作者谈Redis应用场景
- JS复习:第三章&第四章
- 作业3-2
- 傅智杰的第一次C++报告1-1
- c++实验1-输入3个整数,输出其中的最大值
- android 二维码的扫描与生成
- 第二周项目1-宣告主权
- 第二周项目-宣告“主权”
- 就拿胖子说事
- 64. Minimum Path Sum