int max(float x , float y) { float z; z=x>y?x:y; return(z); } int main(){ float a=1.5,b=2.5,c; c=max(a,b); printf("max=%f\n",c); }
举一反三
- #include void main() { int max(flaot x, float y); float a, b; int c; scanf(“%f,%f”, &a, &b); c=max(a, b); printf(“Max is %d”, c);} int max(float x, float y) { float z; z = x > y ? x : y; return z;} 函数max的返回值是什么数据类型( )
- 下列函数定义不正确的是( )。 A: int max() {int x,y,z; z=x>y?x:y; return z;} B: int max(x,y){ int z; z=x>y?x:y; return z;} C: int max(){ } D: int max(int x,int y) {int z; z=x>y?x:y; return(z);}
- 以下程序的功能是计算下面函数的值。请填空。 # include # include float f( float,float,float); int main( ) { float x,y,z,sum; printf("\ninput x,y,z:\n"); scanf("%f%f%f",&x,&y,&z); sum=( ); printf("sum= %f\n",sum); return(0); } float f(float a,float b,float c) { float value; value=( ); return(value); }2f4cdb578a913e638a60b2fa2096c3a4.png
- 判断下面的函数定义中错误的是: A: float volume(float x=1.0,float y=1.0,float z=1.0){return x*y*z;} B: float volume(float x,float y=1.0,float z) {return x*y*z;} C: float volume(float x,float y=1.0,float z=1.0) {return x*y*z;} D: float volume(float x,float y,float z) {return x*y*z;}
- 下列函数定义不正确的是( ) A: int max(){ } B: int max() {int x,y,z; z=x>y?x:y; return z;} C: int max(int x,int y) {int z;z=x>y?x:y; return(z);} D: int max(x,y){ int z; z=x>y?x:y; return z;}