网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

有下列函数定义: 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(),它的功能是:计算和输出下列级数的和。S=1/(1×2)+1/(2×3)+…+1/(n×(n+1))例如,当n=10时,函数值为0.909091。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序;include<conio.h>include<stdio.h>double fun(int n){}main ( ){clrscr();printf("%f\n",fun(10));}

考题 编写函数fun(),它的功能是;根据以下公式求p的值,结果由函数值带回。m与n为两个正数且要求m>n。P=m!/n!(m-n)!),例如:m=12,n=8时,运行结果为495.000000。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <conio.h>include <stdio.h>float fun (int m, int n){}main(){clrscr() ;printf ("p=%f\n", fun (12,8) ) ;}

考题 在执行完下列的C语句段之后,则B的值是( )。 Char a="A"; int b; B=((34 56)(a<'b'));A.int类型B.float类型C.void类型D.函数无类型说明,定义有错

考题 有下列函数定义: fun(float h) { printf("%f,%f\n",h,h*h);} 该函数的类型是( )。A.27B.6C.25D.30

考题 下列给定程序中,函数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);}

考题 学生的记录由学号和成绩组成,N名学生的数据已在主函数中放入结构体数组s中,请编写函数fjun(),该函数的功能是:把高于等于平均分的学生数据放在b所指的数组中,高于等于平均分的学生人数通过形参n传回,平均分通过函数值返回。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <stdio.h>define N 12typede f struct{ char num[10];double s;} STREC;double fun (STREC *a,STREC *b, int *n){}main ( )STREC s IN] = { { "GA05", 85 }, { "GA03", 76 },{"GA02", 69}, {"GA04", 85}, {"GA01", 91},{"GA07", 72}, {"GA08", 64}, {"GA06", 87},{"GA09", 60}, { "GAll", 79 }, { "GA12", 73},{"GA10", 90 } };STREC h[N],t;FILE *out;int i ,j,n;double ave;ave=fun (s, h, n);printf("The %d student data which ishigher than %7.3f: In", n, ave);for(i=0; i<n; i++)printf ("%s %4.1f\n",h[i] .num, h[i] .s);printf ("\n");out=fopen ("out90.dat", "w");fprintf(out, "%dkn %7.3f\n",n,ave);for(i=0; i<n-1; i++)for (j=i+l; j<n; j ++)if (h[i] .s<h[j ] .s){t=h Ii] ;h[i]=h[j] ;h[j]=t; }/*分数从高到低排列*/for(i=0; i<n; i++)fprintf(out, "%4.1f\n",h[i] .s);fclose (out);}

考题 请补充函数fun(),该函数的功能是:计算N×N维矩阵元素的方差,结果由函数返回。维数N在主函数中输入。例如:注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>include <conio.h>include <stdlib.h>include <math.h>define N 20double fun(【 】,int n){int i,j;int k;double s=0.0;double f=0.0;double aver=0.0;double sd=0.0;for(i=0;i<n;i++)for(j=0;j<n;j++)s+=a[i][j];aver=【 】;for(i=0;i<n;i++)for(j=0;i<n;j++)f+=(a[i][j]-aver)*(a[i][j]-aver);f/(n*n);sd=【 】;return sd;}main(){int a[N][N];int n;int i,j;double s;clrscr();printf("***+Input the dimension ofarray N*****\n");scanf("%d",n);printf("***** The array *****\n");for(i=0;i<n;i++){for(j=0;j<n;j++){a[i][j]=rand()%50;while(a[i][j]=0)a[i][j]=rand()%60;printf("%4d",a[i][j]);}printf("\n\n");}s=fun(a,n);printf("******* THE RESULT *******\n");printf("%4.3f\n",s);}

考题 请编写函数fun(),该函数的功能是:计算n门课程的平均分,计算结果作为函数值返回。例如x有5门课程的成绩是90.5,72,80,61.5,55,则函数的值为71.80。注意:部分源程序给出如下.请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <stdio.h>float fun (float *a, int n){}main (){float score[30]=(90.5,72,80,61.5,55},aver;aver=fun(score, 5);printf("\nAverage score is: %5.2f\n",aver);}

考题 若主调用函数类型为double,被调用函数定义中没有进行函数类型说明,而return语句中的表达式类型为float型,则被调函数返回值的类型是()。A.int型B.float型C.double型D.由系统当时的情况而定

考题 请完成函数fun( ),它的功能是:求Fibonacc数列中小于t的最大的一个数,结果由函数 0返回。Fibonacc数列F(n)定义为:F(0)=0,F(1)=1F(n)=F(n-1)+F(n-2)例如:t=1000时,函数为987。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在下划线上填入所需的内容。include<conio.h>include<stdio.h>include<math.h>in fun(int t){int a=l,b=1,c=0,i;do{【 】;a=b;b=C;}while( 【 】);c= 【 】;return C;}main(){int n;clrscr();n=1000;printf("n=%d,f=%d\n",n,fun(n));}

考题 编写函数fun(),它的功能是求n以内(不包括n)同时能被3与7整除的所有自然数之和的平方根s,并做为函数值返回。例如:n为1000时,函数值应为s=153.909064。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <conio.h>include <math.h>include <stdio.h>double fun(int n){}main(){clrscr();printf("s=%f\n", fun(1000));}

考题 请编写函数fun(),它的功能是计算下列级数和,和值由函数值返回。S=1+x+x2/2!3/3!+…/xn/n!例如,当n=10,x=0.3时,函数值为1349859。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun 的花括号中填入所编写的若干语句。试题程序:include<conio.h>include<stdio.h>include<math.h>double fun(double x, int n){}main (){clrscr ();printf ("%f ",fun(0,3,10));}

考题 请编写函数fun(),该函数的功能是:将M行N列的二维数组中的字符数据,按列的顺序依次放到一个字符串中。例如,若二维数组中的数据为:W WWWS S S SH H H H则字符串中的内容应是WSHWSHWSHWSH。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include<stdio.h>define M 3define N 4void fun(char (*s)[N],char *b){}main(){char a[100],w[M][N]={{ 'W', 'W', 'W', 'W'},{'S', 'S', 'S', 'S'},{'H', 'H', 'H', 'H'}};int i,j;printf("The matrix:\n");for(i=0;i<M;i++){ for(j=0;j<N;j++)printf("%3c",w[i][j]);printf("\n");}fun(w,a);printf("The A string:In");puts(a);printf("\n\n");}

考题 编写函数fun(),函数的功能是:根据以下公式计算s,计算结果作为函数值返回;n通过形参传入。S=1+1/(1+2)+1/(1+2+3)+…+1/(1+2+3+…+n)例如:若n的值为11时,函数的值为1.833333。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <conio.h>include <stdio.h>include <string.h>float fun(int n){}main(){int n;float s;clrscr();printf("\nPlease enter N: ");scanf("%d",n);s=fun(n);printf("The result is:%f\n " , s);}

考题 学生的记录由学号和成绩组成,N名学生的数据已存放在主函数的结构体数组s中,请编写函数fun,它的功能是:把低于平均分的学生数据放在b所指的数组中,低于平均分的学生人数通过形参n传回,平均分通过函数值返回。[注意] 部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在fun函数的花括号中填入所编写的若干语句。[试题源程序]include<stdio.h>define N 8typedef struct{char num[10];double s;}STREC;double fun(STREC *a, STREC *b, int *n){}void main(){STREC s[N]={{"GA05", 85},{"GA03", 76}, {"GA02", 69}, {"GA04", 85},{"GA01", 91}, {"GA07", 72}, {"GA08", 64},{"GA06", 87}};STREC h[N], t; FILE *out;int i, j, n;double ave;ave=fun(s, h, &n);printf("The %d student data which is lower than %7.3 f:\n", n, ave);for(i=0; i<n; i++)printf("%s %4.1f\n", h[i]. num, h[i].s);printf("\n");ut=fopen("out.dat", "W");fprintf(out, "%d\n%7.3f\n", n, ave);for(i=0; 2<n-1; i++)for(j=i+1; j<n; j++)if(h[i]. s>h[j].s){t=h[i];h[i]=h[j];h[j]=t;}for(i=0; 2<n; i++)fprintf(out, "%4.1f\n", h[i].s);fclose(out);}

考题 请编写函数fun(),它的功能是求Fibonacci数列中小于t的最大的一个数,结果由函数返回。其中Fibonacci数列F(n)的定义为F(0)=0,F(1)=1F(n)=F(n-1)+F(n-2)例如:t=1000时,函数值为987。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <conio.h>include <math.h>include <stdio.h>int fun(int t){}main(){int n;clrscr();n=1000;printf("n=%d, f=%d\n",n, fun(n));}

考题 设有如下的函数______。 f(x) float x; {printf("\n%d",x*x); }则函数类型A.与参数x类型相同B.是voidC.是intD.无法确定

考题 若有以下程序includevoidf(intn);main() (voidf(intn); f(5); }void f(intn) {printf( 若有以下程序 #include <stdio.h> void f(int n); main() ( void f(int n); f(5); } void f(int n) { printf("%d\n",n); } 则以下叙述中不正确的是A.若只在主函数中对函数f进行说明,则只能在土函数中正确调用函数fB.若在主函数前对函数f进行说明,则在主函数和其后的其他函数中都可以正碗调用函数fC.对于以上程序,编译时系统会提示出错信息:提示对f函数重复况明D.函数f无返回值,所以可用void将其类型定义为无值型

考题 请编写函数fun(),它的功能是计算下列级数和,和值由函数值返回。S=1-x+x2(上标)/2!-x3(上标)/3!+…+ (-1*x) n(上标)/n!例如,当n=15,x=0.5时,函数值为0.606531。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include<conio.h>include<stdio.h>include<math.h>double fun(double x, int n){}main(){clrscr();printf("%f ",fun (0.5,15));}

考题 有下列函数定义: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(),它的功能是求n以内(不包括n)同时能被5与11整除的所有自然数之和的平方根s,并作为函数值返回。例如:n为1000时,函数值应为s=96.979379。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <conio.h>include <math.h>includedouble fun(int n){}main(){clrscr();printf("s=%f\n",fun(1000));}

考题 请编写函数fun(),它的功能是计算:s=(1-In(1)-In(2)-In(3)-…-1n(m))2s作为函数值返回。在C语言中可调用log(n)函数求In(n)。log函数的引用说明是double log(double x)。例如,若m的值为15,则fun()函数值为723.570801。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <conio.h>include <stdio.h>include <math.h>double fun(int m){}main(){clrscr();printf("%f\n",fun(15));}

考题 有下列函数定义: fun(float h) { printf("%f,%f\n",h,h*h);) 该函数的类型是( )。A.int类型SX 有下列函数定义: fun(float h) { printf("%f,%f\n",h,h*h);) 该函数的类型是( )。A.int类型B.float类型C.void类型D.函数无类型说明,定义有错

考题 下列给定程序中,函数fun()的功能是:计算S=f(-n)+f(-n+1)+…+f(0)+f(1)+f(2)+…f(n)的值。例如,当n为5时,函数值应为10.407143。f(x)函数定义如下:请改正程序中的错误,使它能得山正确的结果。注意:不要改动main 函数,不得增行或删行,也不得更改程序的结构。试题程序:include <conio. h>include <stdio. h>include <math. h>/**************found***************/f (double x){if (x==0.0 || x==2.0)return 0.0;else if (x<0.0)return (x-1) / (x-2);elsereturn (x+1) / (x-2);}double fun(int n){int i; double s=0.0,y;for (i=-n; i<=n; i++){ y=f(1.0*i); s+=y;}/**************found**************/return s}main(){ clrscr();printf ("%f\n", fun (5));}

考题 给定程序中,函数fun()的功能是:使数组中的元素的值缩小5倍。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序:include<stdio.h>include<conio.h>float m[10];/*************found**************/int fun (void){int j;printf("In subfunc after calling\n");for(j=O;j<lO;j++){;/*************found**************/print ("%f ",m[j]%5);}}main(){int i;printf ("In main before calling\n");for (i=0;i<10;i++){m[i]=i+20;printf("%f ",m[i]);}fun();printf("\nIn main after calling\n");for(i=O; i<10;i++)printf("%f ",m[i]/5);}

考题 请编写函数fun(),该函数的功能是:计算并输出S=1+(1+20.5)+(1+20.5+30.5)+…+(1+20.5+30.5+…+n0.5)例如,若主函数从键盘给n输入20后,则输出为s=534.188884。注意;部分源程序给出如下。请勿改动主函数main 和其他函数中的任何内容,仅在函数fun 的花括号中填入所编写的若干语句。试题程序:include <math. h>include <stdio. h>double fun(int n){}main(){int n;double s;printf("\n\nInput n: ");scanf ("%d", n);s=fun (n)printf ("\n\ns=%f\n\n", s);}

考题 请编一个函数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) );}