答案错误fattestis 10027008.000000 kg ,int f0里哪错了?

来源:百度知道 编辑:UC知道 时间:2024/06/03 23:48:53
int main(void)
{
double max_weight;
double a=72.0,b=101.5,c=52.5;

max_weight=f0(a,b,c);
printf("fattestis %lf kg\n",max_weight);
return 0;
}
int f0(double max_weight)
{double a,b,c;
if(a<b,b<c)
max_weight=c;
else
if(a<c,c<b)
max_weight=b;
else
if(b<c,c<a)
max_weight=a;
else
if(b<a,a<c)
max_weight=c;
else
if(c<a,a<b)
max_weight=b;
else
max_weight=a;
}

编译通过
#include <stdio.h>

float f0(float a, float b, float c);

int main(void)
{
float max_weight;
float a=72.0,b=101.5,c=52.5;

max_weight = f0(a,b,c);
printf("fattestis %.1lf kg\n",max_weight);
return 0;
}
float f0(float a, float b, float c)
{
float max_weight;
if(a<c && c<b)
max_weight=c;
else
if(a<c && c<b)
max_weight=b;
else
if(a<c && c<b)
max_weight=a;
else
if(a<c && c<b)
max_weight=c;
else
if(a<c && c<b)
max_weight=b;
else
max_weight=a;
return max_weight;
}

int f0(double max_weight) 是三个形参
if(a<c,c<b)不是这样写的晕~~~
应该这样写if(a<c&&c<b)