主题:求助(调用函数):谁能帮我分析一下为什么会出现这些情况
情况一:
main()
{float a,b;
int c;
int max(float, float);
scanf("%f,%f",&a,&b);
c=max(a,b);
printf("max is %d\n",c);
}
max(float x,float y)
{float z;
z=x>y?x:y;
return(z);}
运行结果如下:
1.5,2.5 enter
max is 2(这种情况我能理解)
情况二:
main()
{float a,b;
[color=FF0000]float c;[/color]
int max(float, float);
scanf("%f,%f",&a,&b);
c=max(a,b);
printf("max is %[color=FF0000]f[/color]\n",c);
}
max(float x,float y)
{float z;
z=x>y?x:y;
return(z);}
运行结果如下:
1.5,2.5 enter
max is 2.000000(这种情况我有点不能理解了)
情况三:
main()
{float a,b;
[color=FF0000]float c;[/color]
[color=FF0000]float[/color] max(float, float);
scanf("%f,%f",&a,&b);
c=max(a,b);
printf("max is %[color=FF0000]f[/color]\n",c);
}
max(float x,float y)
{float z;
z=x>y?x:y;
return(z);}
(调试怎么会出现1处错误呢)
情况四:
main()
{float a,b;
[color=FF0000]float c;[/color]
scanf("%f,%f",&a,&b);
c=max(a,b);
printf("max is %[color=FF0000]f[/color]\n",c);
}
[u]int max(float x,float y)[/u]
{float z;
z=x>y?x:y;
return(z);}
运行结果如下:
1.5,2.5 enter
max is 1.000000(怎么结果变成1了呢?)
谢谢哪位大哥大姐帮我解释一下!!!!!!
main()
{float a,b;
int c;
int max(float, float);
scanf("%f,%f",&a,&b);
c=max(a,b);
printf("max is %d\n",c);
}
max(float x,float y)
{float z;
z=x>y?x:y;
return(z);}
运行结果如下:
1.5,2.5 enter
max is 2(这种情况我能理解)
情况二:
main()
{float a,b;
[color=FF0000]float c;[/color]
int max(float, float);
scanf("%f,%f",&a,&b);
c=max(a,b);
printf("max is %[color=FF0000]f[/color]\n",c);
}
max(float x,float y)
{float z;
z=x>y?x:y;
return(z);}
运行结果如下:
1.5,2.5 enter
max is 2.000000(这种情况我有点不能理解了)
情况三:
main()
{float a,b;
[color=FF0000]float c;[/color]
[color=FF0000]float[/color] max(float, float);
scanf("%f,%f",&a,&b);
c=max(a,b);
printf("max is %[color=FF0000]f[/color]\n",c);
}
max(float x,float y)
{float z;
z=x>y?x:y;
return(z);}
(调试怎么会出现1处错误呢)
情况四:
main()
{float a,b;
[color=FF0000]float c;[/color]
scanf("%f,%f",&a,&b);
c=max(a,b);
printf("max is %[color=FF0000]f[/color]\n",c);
}
[u]int max(float x,float y)[/u]
{float z;
z=x>y?x:y;
return(z);}
运行结果如下:
1.5,2.5 enter
max is 1.000000(怎么结果变成1了呢?)
谢谢哪位大哥大姐帮我解释一下!!!!!!