题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-22 20:55:04

[简答题]编写函数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) ) ; }

更多"编写函数fun( ),它的功能是;根据以下公式求p的值,结果由函数值带"的相关试题:

[简答题]编写函数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) ) ;

[填空题]下列给定程序中.函数fun的功能是按以下递归公式求函数值。
例如,当给n输入3时,函数值为60;当给n输入6时,函数值为480。
请修改程序中的错误,使它能得到正确结果。
注意:不要改动main( )函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include<stdio.h>
//************found*************
fun(int n);

int j;
//************found*************
if(n=1)
j=15;
else
j=fun(n=1) *2;
return(j);

void main( )

int n;
printf("Enter n: ");
scanf("%d", &n);
printf("The result: %d/n/n", fun(n));

[简答题]m个人的成绩存放在score数组中,请编写函数fun( ),它的功能是:将低于平均分的人数作为函数值返回,将低于平均分的分数放在below所指的数组中。 例如,当score数组中的数据为10,20,30,40,50,60, 70,80,90时,函数返回的人数应该是4,below中的数据应为10,20,30,40。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include <conio.h> #include <stdio.h> #include <string.h> int fun(int score[],int m, int below[]) { } main( ) { iht i, n, below[9]; int score[9]={10,20,30,40,50,60,70, 80,90}; clrscr( ); n=fun(score, 9, below); printf("/nBelow the average score are: "); for(i=0;i<n;i++) printf("%d",below[i]); }
[简答题]请编写一个函数fun( ),它的功能是:根据以下公式求π的值(要求满足精度0.005,即某项小于0.005时停止迭代)。
π/2=1+1/3+1*2/(3*5)+1*2*3/(3*5*7)+1*2*3*4/(3*5*7*9)+…+1*2*3*…*n/(3*5*7*…*(2n+1))
程序运行后,如果输入精度0.0005,则程序输出3.14…。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include<conio.h>
#include<math.h>
double fun(double eps)

main( )

double x;
printf("Input eps: ");
scanf("%1f", &x);
printf("/neps=%1f,PI=%1f/n",x,fun(x));

[简答题]请编写函数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));

[简答题]请编写函数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( )的功能是:根据以下公式求n的值,并作为函数值返回。例如,给指定精度的变量eps输入 0.0005时,应当输出Pi=3.140578。
n/2=1+1/3+1/3*2/5+1/3*2/5*3/7+1/3*2/5*3/7*4/9……
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
试题程序:
#include <conio.h>
#include <stdio.h>
#include <math.h>
double fun(double eps)
double s,t; int n=t;
s=0.0;
/*************found**************/
t=1;
/*************found**************/
while(t>eps)
s+=t;
t=t*n/(2*n+1);
n++;

/*************found**************/
return (s);

main( )
double x;
printf("/nPlease enter a precision: ");
scanf("%1f",&x);
printf("/nPi=%1f/n ",fun(x));

[简答题]编写函数fun,其功能是:求Fibonacci数列中大于t的最小的数,结果由函数返回。Fibonacci数列F(n)的定义为:
F(0)=0,F…=1
F(n)=F(n-1)+F(n-2)
例如,当t=1000时,函数值为1597。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
试题程序:
#include<conio.h>
#include<math.h>
#include<scdio.h>
int fun(int t)


main( )

int n;
n=1000;
printf("n=%d,f=%d/n",n,fun(n));

[简答题]编写函数jsValue( ),其功能是:求Fibonacci数列中大于t的最小的一个数,结果由函数返回。其中Fibonacci数列F(n)的定义为:
F(0)=0,F(1)=1
F(n)=F(n-1)+F(n-2)
最后调用函数writeDat( )从in.dat中读取50个数据t,分别得出结果,且把结果输出到out.dat文件中。
例如:当t=1000时,函数值为:1597。
注意:部分程序已经给出。
请勿改动主函数main( )和写函数writeDat( )的内容。
#include<Stdio.h>
int jsValue(int t)


void writeDat( )

FILE *in,*out;
int i,n,s;
in=fopen("in.dat","r");
out=fopen("out.dat","w");
for(i=0;i<50; i++)

fscanf(in,"%d,",&n);
S=jsValue(n);
fprintf(out,"%d/n",s);

fclose(in);
fclose(out);

main( )

int n;
n=1000;
printf("t=%d,f=%d/n",n,jsValue(n));
writeDat( );

[简答题]编写函数jsValue( ),它的功能是求Fibonacci数列中大于t的最小的一个数,结果由函数返回,其中Fibonacci数列F(n)的定义为:F(0)=0,F(1)=1F(n)=F(n-1)+F(n-2)最后调用函数writeDat( ),把结果输出到文件OUT10.DAT中。例如:当t = 1000时,函数值为1597。注意:部分源程序已给出。请勿改动主函数main( )和写函数WriteDat( )的内容。试题程序:#include int jsValue(int t){ }main( ){int n;n=1000;printf("n=%d, f=%d/n", n, jsValue(n));writeDat( );}writeDat( ){FILE *in, *out;int n,s;out = fopen("OUT10.DAT", "w");s = jsValue(1000); printf("%d",s);fprintf(out, "%d/n", s);fclose(out);}

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码