网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
请完成函数fun( ),它的功能是:求Fibonacc数列中小于t的最大的一个数,结果由函数 0返回。Fibonacc数列F(n)定义为:
F(0)=0,F(1)=1
F(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( ),它的功能是:求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));} ” 相关考题
考题
编写函数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<stdio.h>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;ut = fopen("OUT10.DAT", "w");s = jsValue(1000); printf("%d",s);fprintf(out, "%d\n", 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));}
考题
编写函数jsValue(),它的功能是求Pibonacci数列中大于t的最小的一个数,结果由函数返回,其小 Fibonacci数列F(n)的定义为:F(0)=0, F(1)=1 ’F(n)=F(n-1)+F(n-2)最后调用函数writeDat(),把结果输出到文件OUT10.DAT中。例如:当t=1000时,函数值为1597。注意:部分源程序已给出。请勿改动主函数main()和写函数WriteDat()的内容。试题程序:includeint 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);}
考题
编写函数jsvalue(),其功能是:求Fibonacci数列中大于t的最小的一个数,结果由该函数返回。其中,Fibonacci数列F(n)的定义如下。F(0)=0, F(1)=1F(n)=F(n-1)+F(n-2)最后,调用函数writeDat()读取10个数据t,分别得出结果,并把结果输出到文件out.dat中。例如:当t=1000时,函数值为1597。部分源程序已给出。请勿改动主函数main()和写函数writeDat()的内容。#include stdio.hint 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; i50; 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();}
考题
编写函数,isValue(),它的功能是求Fibonacci数列中大于t的最小的一个数,结果由函数返回,其中 Fibonacci数列F(n)的定义为:F(0)=0,F(1)=1F(n)=F(n-1)+F(n-2)最后调用函数writeDat(),把结果输出到文件OUTl0.DAT中。例如:当t=1000时,函数值为1597。注意:部分源程序已给出。请勿改动主函数main()和写函数WriteDat()的内容。include <stdio.h>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;ut = fopen ("OUT10.DAT", "w");s = jsValue(1O00); printf("% d",s);fprintf(out, "%d\n", s);fclose (out);}
考题
fun函数的功能是首先对a所指的N行N列的矩阵找出各行中最大的数,再求这N个最大值中最小的那个数作为函数值返回,请填空。#include stdio.h#define N 100int fun(int(*a)[N]){ int row,col,max,min; for(row=0;rowN;row++) { for(max=a[row][0],col=1;colN;col++) if() max=a[row][col]; if(row==0) min=max; else if() min=max; } return min;}
考题
给定程序MODll.C中函数fun的功能是:统计一个无符号整数中各位数字值为零的个数,通过形参传回主函数;并把该整数中各位上最大的数字值作为函数值返回。例如,若输入无符号整数30800,则数字值为零的个数为3,各位上数字值最大的是8。请改正函数fun中指定部位的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
考题
编写函数jsValue(int t),它的功能是:求Fibonacci数列中大于t的最小的一个数,结果由函数返回。其中Fibonacci数列F(n)的定义为: F(0)=0,F(1)=1 F(n)=F(n-1)+F(n-2) (n≥2) 最后调用函数writeDat读取l0个数据t,分别得出结果且把结果输出到文件out.dat中。 例如:当t=1000时,函数值为:1597。 注意:部分源程序存在test.c文件中。 请勿改动数据文件in.dat中的任何数据、主函数main和写函数writeDat的内容。
考题
请编写函数proc(),它的功能是求Fibonacci数列中小于n的最大的一个数,结果由函数返回。Fibonacci数列F(n)的定义为F(0)=O,F(1)=1F(n)=F(n-1)+F(n-2)例如,n=500时,函数值为377。注意:部分源程序给出如下。请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的花括号中填写所编写的若干语句。试题程序:
热门标签
最新试卷