有下列函数定义:fun(float h){printf("%f,%f\n",h,h*h);}该函数的类型是()。A.int类型B.float类型
有下列函数定义: fun(float h) { printf("%f,%f\n",h,h*h);} 该函数的类型是()。
A.int类型
B.float类型
C.void类型
D.函数无类型说明,定义有错
有下列函数定义: fun(float h) { printf("%f,%f\n",h,h*h);} 该函数的类型是()。
A.int类型
B.float类型
C.void类型
D.函数无类型说明,定义有错
设fun函数的定义形式为
void fun(char ch,float x){…}
则下列对函数fun的调用语句中,正确的是()。
A.A.fun("abc",3.0);
B.t=fun('D'.16.5);
C.fun('65',2.8);
D.fun(32,32);
请编一个函数float fun (double h),函数的功能是对变量h中的值保留两位小数,并对第三位进行四舍五入(规定h中的值为正数)。
例如:若h值为8.32433,则函数返回8.32:若h值为 8.32533,则函数返回8.33。
注意:部分源程序给出如下。
请勿改动主函数main 和其他函数中的任何内容,仅在函数。fun 的花括号中填入所编写的若干语句。
试题程序:
include <stdio. h>
include <conio. h>
float fun (float h )
{
}
main()
{
float a;
clrscr ();
printf ("Enter a: ");
scanf ("%f", &a);
printf("The original data is : ");
printf("%f\n\n", a) ;
printf("The result: %f\n", fun(a) );
}
下列给定程序中,函数fun()的功能是;计算函数 F(x, y ,z)=(x+ y)/(x-y)+(z+ y)/(z-y)的值。其中x和y不相等,z和y不等。例如,当x的值为9,y的值为11,2的值为15时,函数值为-3.50。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main 函数,不得增行或删行,也不得更改程序的结构。
试题程序:
include <stdio. h>
include <math. h>
/**************found******************/
define FU(m, n) (m/n)
float fun(float a, float b, float c)
{ float value;
value=FU(a+ b, a-b)+FU(c+ b, c-b);
/*************found******************/
return(Value);
}
main()
{ float x, y, z, sum;
printf ("Input x y z:: ");
scanf("%f%f%f", &x, &y, &z);
printf("x=%f, y=%f, z=%f\n ",x, y, z);
if (x==y||y==z) {printf ("Data error! \n ");
exit (0); }
sum=fun (x, y, z);
printf("The result is:%5. 2f\n ",sum);
}
A.fun("abc",3.0);
B.t=fun('D',16.5);
C.fun('65',2.8);
D.fun(32,32);
A)
main()
{ …… x=fun(2,10); …… }
float fun(int a,int b){ …… }
B)
float fun(int a,int b){ …… }
main()
{ …… x=fun(i,j); …… }
C)
float fun(int,int);
main()
{ …… x=fun(2,10); …… }
float fun(int a,int b) { …… }
D)
main()
{ float fun(int i,int j);
…… x=fun(i,j); …… }
float fun(int a,int b){ …… }
下列给定程序中,函数fun()的功能是;求S的值。设 S=(22/1*30))*(42/(3*5))*(62/(5*7))*…*(2k)2/((2k-1)*(2k+1))
例如,当k为10时,函数的值应为1.533852。
请改正程序中的错误,使它能得出正确的结果。
注童;不要改动main 函数,不得增行或删行,也不得更改程序的结构。
试题程序:
include <conio. h>
include <stdio. h>
include <math.h >
/**************found***************/
fun (int k)
{ iht n; float s, w, p, q;
n=1;
s=1.0;
while (n<=k)
{ w=2. 0*n;
p=w-1.0;
q=w+1.0;
s=s*w*w/p/q;
n++;
}
/***************found**************/
return s
}
main()
{ clrscr ();
printf ("%f\n ", fun (10));
}
A.mam() {…… x=fun(2,10); ……} fioat fun(int a,int b) { ……}
B.float fun (int a,int b) {……} main() {…… x=fun(i,j); ……}
C.float fun (int int); main() {…… x=fun(2,10); ……} float fun (int a,int b){ ……}
D.main() { float fun (int i, int j); …… x=fun(i,j); ……} float fun (int a,int b){ ……}
A.p=fun
B.p=fp(3.5)
C.p=A::fun
D.p=A::fun(3.5)
下列重载函数中,正确的是()。
A.void fun(int a,float b);void fun(int c,float d)
B.void fun(int a,float b);void fun(float a,int b)
C.float fun(int a,float b);int fun(int b,float a)
D.int fun(int a,int b);float fun(int a,int b)
有下列函数定义:int fun(double a,double b) {return a*b;} 若下列选项中所用变量都己正确定义并赋值,错误的函数调用是()。
A.if(fun(x,y)){……}
B.z=fun(fun(x,y),fun(x,y));
C.z=fun(fun(x,y)x,y);
D.fun(x,y);