题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-07-31 07:06:37

[简答题]请编写函数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( ),它的功能是计算下列级数和,和值由函数值返回。 "的相关试题:

[简答题]请编写函数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));
}
[简答题]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( ),该函数的功能是:计算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); }
[简答题]请编写函数fun,该函数的功能是:判断字符串是否为回文,若是,函数返回1,主函数中输出Yes,否则返回0,主函数中输出No。回文是指顺读和倒读都一样的字符串。
例如:字符串"LEVEL"是回文,而字符串"123312"就不是回文。
注意:部分源程序在文件PROG1.C中。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
文件PROG1.C内容如下:
#include<stdio.h>
#define N 80
int fun(char *str)


void main( )
char s[N];
printf("Enter a string:");
gets(s);
printf("/n/n");
puts(s);
if(fun(s)) printf(" YES/n");
else printf(" NO/n");

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

[简答题]请编写函数fun,函数的功能是:将3行4列矩阵x乘以4行3列矩阵y,结果放在 3行3列矩阵xy中。矩阵相乘的基本方法是:矩阵xy中行列下标分别为i、j的元素的值,是矩阵x中第i行上4个元素与矩阵y中第j列上4个元素对应相乘的和。 注意:部分源程序在文件PROG1.C中。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。 #include <conio.h> #include <stdio.h> void fun(int a[3][4],int b[4][3],int ab[3][3]) { } main( ) {int x[3][4]={{1,0,1,1},{2,1,0,1},{1,2,0,3}}; int y[4][3]={{1,1,1},{0,0,0},{2,1,1},{1,1,3}}; int xy[3][3]={0},i,j; clrscr( ); fun(x,y,xy); printf("a x b=ab:(3,3):"); for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d",xy[i][j]); printf("/n"): } NONO( );/*本函数与考生答题无关,考生不得改动,否则后果自负。*/ }
[简答题]请编写函数fun, 函数的功能是: 将M行N列的二维数组中的数据,按行的顺序依次放到一维数组中, 一维数组中数据的个数存放在形参n所指的存储单元中。 例如, 二维数组中的数据为: 33 33 33 33 44 44 44 44 55 55 55 55 则一维数组中的内容应是: 33 33 33 33 44 44 44 44 55 55 55 55。 注意:部分源程序在文件PROG1.C中。请勿改动主函数main和其它函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。 给定源程序: #include void fun(int (*s)[10], int *b, int *n, int mm, int nn) { } main( ) { int w[10][10] = {{33,33,33,33},{44,44,44,44},{55,55,55,55}},i,j ; int a[100] = {0}, n = 0 ; printf("The matrix:/n") ; for(i = 0 ; i < 3 ; i++) { for(j = 0 ; j < 4 ; j++) printf("=",w[i][j]) ; printf("/n") ; } fun(w, a, &n, 3, 4) ; printf("The A array:/n") ; for(i = 0 ; i < n ; i++) printf("=",a[i]);printf("/n/n") ; NONO( ) ; }
[简答题]请编写函数fun, 函数的功能是: 删去一维数组中所有相同的数, 使之只剩一个。数组中的数已按由小到大的顺序排列,函数返回删除后数组中数据的个数。 例如, 一维数组中的数据是: 2 2 2 3 4 4 5 6 6 6 6 7 7 8 9 9 10 10 10。 删除后,数组中的内容应该是: 2 3 4 5 6 7 8 9 10。 注意:部分源程序在文件PROG1.C中。 请勿改动主函数main和其它函数中的任何内容, 仅在函数fun的花括号中填入你编写的若干语句。 给定源程序: #include #define N 80 int fun(int a[], int n) { } main( ) { int a[N]={2,2,2,3,4,4,5,6,6,6,6,7,7,8,9,9,10,10,10,10},i,n=20; printf("The original data :/n"); for(i=0; in=fun(a,n); printf("/n/nThe data after deleted :/n"); for(i=0;i}
[简答题]请编写函数fun,该函数的功能是:将M行N列的二维数组中的数据,按列的顺序依次存放到一维数组中。函数fun中给出的语句仅供参考。
例如,二维数组中的数据为:
33 33 33 33
44 44 44 44
55 55 55 55
则一维数组中的内容应是:
33 44 55 33 44 55 33 44 55 33 44 55
注意:部分源程序在文件PROG1.C中。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
文件PROG1.C内容如下:
#include<stdio.h>
void fun(int(*s)[10],int *b,int *n,int mm,int nn)
/*以下代码仅供参考*/
int i,j,np=0; /*np用作b数组的下标*/

void main( )
int w[10][10]=33,33,33,33,44,44,44,44,55,55,55,55,i,j;
int a[100]=0,n=0;
printf("The matrix: /n");
for(i=0;i<3;i++)
for(j=0;j<4;j++)printf("%3d",w[i][j]);
printf("/n");

fun(w,a,&n,3,4);
printf("The A array: /n");
for(i=0;i<n;i++)printf("%3d",a[i]);
printf("/n/n");
[填空题]请编写函数fun,该函数的功能是:将两个两位数的正整数a、b合并形成一个整数放在c中。合并方式是:将a数的十位和个位数依次放在c数的干位和十位上,b数的十位和个位数依次放在c数的个位和百位上。例如:当a=32,b=78。调用该函数后,c=3827。 #include <conio.h> #include <Stdio.h> void fun(int a,int b, (1) ) { (2) ; } main( ) { int a,b;long c; clrscr( ); printf("Input a,b:"); scanf("%d%d",&a,&b); fun(a,b,&c); printf("The result is:%ld/n",c); NONO( );/*本函数与考生答题无关,考生不得改动,否则后果自负。*/ }
[简答题]请编写函数fun,该函数的功能是:移动字符串中的内容,移动的规则如下:把第1~m个字符平移到字符串的最后,把第m+1到最后的字符移到字符串的前部。
例如:字符串中原有的内容为ABCDEFGHIJK,m的值为3,则移动后字符串中的内容应该是DEFGHIJKABC。
注意:部分源程序在文件PROG1.C中,请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
文件PROG1.C内容如下:
#include<stdio.h>
#include<string.h>
#define N 80
void fun(char *w,int m)


void main( )
char a[N]="ABCDEFGHIJK":
int m;
printf("The original string:/n");
puts(a);
printf("/nEnter m:/n");
scanf("%d",&m);
fun(a,m);
printf(:/n The string after moving: /n");
puts(a);
printf("/n");

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

[简答题]请编写函数fun( ),函数的功能是求出二维数组周边元素之和,作为函数值返回。二维数组中的值在主函数中赋予。 例如:若二维数组中的值为 1 3 5 7 9 2 9 9 9 4 6 9 9 9 8 1 3 5 7 0 则函数值为61。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include<conio.h> #include<stdio.h> #define M 4 #define N 5 int fun( int a [M][N]) { } main( ) { int aa[M][N]={{1,3,5,7,9},{2,9,9,9,4}, {6,9,9,9,8},{1,3,5,7,0}}; int i, j, y; clrscr( ); printf ("The original data is :/n "); for(i=0; i<N;i++) {for (j=0; j<N;j++) printf("%6d ",aa[i][j]); printf("/n "); } y=fun(aa); printf("/nThe sun:%d/n ",y); printf("/n"); }
[简答题]假定输入的字符串中只包含字母和*号。请编写函数fun,它的功能是:删除字符串中所有的*号。在编写函数时,不得使用C语言提供的字符串函数。
例如,字符串中的内容为:****A*BC*DEF*G********,删除后,字符串中的内容应当是:ABCDEFG。
注意:部分源程序在文件PROG1.C中。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
文件PROG1.C内容如下:
#include<stdio.h>
void fun(char *a)


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

我来回答:

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

订单号:

截图扫码使用小程序[完全免费查看答案]
请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码