您的位置:首页 > 其它

第二周项目二———就拿胖子说事

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.}


运行结果:







                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: