注意下面有作业。
编辑:
取出无用信息。
所以显然这是一个家庭作业,除了我的函数内部的计算之外,一切似乎都是正确的。
如何返回非截断值?
float hat(float weight, float height) {
return (weight/height)*2.9;
}
float jacket(float weight, float height, int age) {
double result = (height * weight) / 288;
/*now for every 10 years past 30 add (1/8) to the result*/
if((age - 30) > 0){
int temp = (age - 30) / 10;
result = result + (temp * .125);
//cout<<"result is: "<<result<<endl;
}
return result;
}
float waist(float weight, int age) {
double result = weight / 5.7;
/*now for every 2 years past 28 we add (1/10) to the result*/
if((age - 28) > 0){
int temp = (age - 28) / 2;
result = result + (temp * .1);
}
return result;}