题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-03 12:59:36

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

更多"编写函数fun,其功能是:求Fibonacci数列中大于t的最小的数,"的相关试题:

[简答题]编写函数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);}
[简答题]规定输入的字符串中只包含字母和*号。编写函数fun,其功能是:删除字符串中所有的*号。编写函数时,不得使用C语言提供的字符串函数。
例如,字符串中的内容为“****A*BC*DEF*G*******”,删除后,字符串中的内容应当是“ABCDEFG”。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include<conio.h>
#include<stdio.h>
void fun(char*a)

int i,j=0;
for(i=0;a[i]!=’/0’;i++)
if(a[i]!=’*’)
a[j++]=a[i];/*若不是要删除的字符’*’则保留*/
a[j]=’/0’;/*最后加上字符串结束符’/0’*/

void main( )

char s[81];
printf("Enter a string:/n");
gets(s);
fun(s);
printf("The string after deleted:/n");
puts(s);

[简答题]编程题请编写函数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 #include #include int fun(int t){}main( ){ int n; clrscr( ); n=1000; printf("n=%d, f=%d/n",n, fun(n));}
[简答题]请编写函数fun( ),它的功能是求Fibonacci数列中小于t的最大的一个数,结果由函数返回。其中Fibonacci数列F(n)的定义为
F(0)=0,F(1)=1
F(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));

[简答题]编写函数fun,其功能是:计算凡门课程的平均分,结果作为函数值返回。
注意:部分源程序给出如下。
请勿改动主函数maln和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
试题程序:
#include < stdio.h >
float fun float * a, int n)


void main

float score[30]=90. 5, 72, 80,
61.5, 55 , aver;
aver=fun (score, 5);
printf ("/nAverage score is:% 5.2f
/n", aver);

[简答题]编写函数fun,其功能是:计算n门课程的平均分,结果作为函数值返回。
例如,若有5门课程的成绩是:90.5,72,80,61.5,55,则函数的值为71.80。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
试题程序:
#include <stdio.h>
float fun(float * a, int n)

void main( )

float score[30]=90.5, 72, 80, 61.5, 55), aver;
aver=fun(score, 5);
printf("/nAverage score is:% 5.2f/n", aver);

我来回答:

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

订单号:

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