首页 > 其他 > 详细

L1-031. 到底是不是太胖了

时间:2017-08-08 18:22:42      阅读:406      评论:0      收藏:0      [点我收藏+]

#include <iostream>
#include <math.h>
using namespace std;

int isTooFat(float &a, float &b)
{
a = (a - 100) * 0.9 * 2;
//calculate the standard weight, unit is market jin
cout << a << endl;
cout << a*1.1 << endl;
if(fabs(a*0.9-b)<0.0000000001)
return -1;
if(fabs(a*1.1-b)<0.0000000001)
return 1;
if(a*0.9<b&&b<a*1.1)
return 0;
if(b<a*0.9)
return -1;
return 1;
}
int main()
{
int n;
float height, weight;
cin >> n;
int a[n];
for(int i=0; i<n; i++)
{
cin >> height >> weight;
a[i] = isTooFat(height, weight);
}
for(int i=0; i<n; i++)
{
switch (a[i])
{
case 0:
cout << "You are wan mei!\n";
break;
case 1:
cout << "You are tai pang le!\n";
break;
case -1:
cout << "You are tai shou le!\n";
break;
default:
break;
}
}
//cout << "Hello world!" << endl;
return 0;
}

L1-031. 到底是不是太胖了

原文:http://www.cnblogs.com/1915884031A-qqcom/p/7308039.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!