码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-08-08 19:59:09      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:and   break   end   hello   str   math.h   a*   cas   namespace   

#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. 到底是不是太胖了

标签:and   break   end   hello   str   math.h   a*   cas   namespace   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!