比较3个数的最大数字,我的程序那里出问题拉!记过不是我要的!编译也没有提示出错!!得出的结果是max=3006

来源:百度知道 编辑:UC知道 时间:2024/05/24 19:58:44
#年include <stdio.h>
void main()
{
int max(int x,int y, int z);
int a,b,c,d;
scanf("%d,%d,%d",&a,&b,&c);
d=max(a,b,c);
printf("max=%d\n",d);
}
int max(int x,int y,int z)
{
int r,t;
if (x>y) x=t;
else y=t;
if (t>z) r=t;
else r=z;
return(r);
}

int max(int x,int y,int z)
{
int r,t;
if (x>y) x=t; 这里t没有初始化就使用了,是错误的。
else y=t;
if (t>z) r=t;
else r=z;
return(r);
}

int max(int x,int y,int z)
{
int t;
if (x>y) t=x;
else t=y;
if (t<z)t=z ;
return(t);
}

头文件有个“年”字是啥意思?