题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-23 06:14:56

[简答题]请编写函数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( ),函数的功能是求出二维数组周边元素之和,作为函数"的相关试题:

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

[简答题]下列程序定义了NXN的二维数组,并在主函数中赋值。请编写函数fun( ),函数的功能是求出数组周边元素的平方和并作为函数值返回给主函数中的s。例如:若a数组中的值为
a=0 1 2 7 9
1 11 21 5 5
2 21 6 11 1
9 7 9 10 2
5 4 1 4 1
则返回主程序后s的值应为310。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
试题程序:
#include <stdio.h>
#include<conio.h>
#include<stdlib.h>
#define N 5
int fun (int w[][N])

main( )

int a[N][N]=0,1,2,7,9,1,11,21,5,5,2, 21,6,11,1,9,7,9,10,2,5,4,1,4,1;
int i,j;
int s;
clrscr( );
printf("*****The array***+*/n");
for (i=0;i<N;i++)
for(j=0;j<N;i++)
printf("%4d",a[i][j]);
printf("/n");

s=fun(a);
printf("*****THE RESULT*****/n");
printf("The sum is:%d/n",s);

[简答题]请编写函数proc( ),函数的功能是求出二维数组周边元素之和,作为函数值返回。二维数组中的值在主函数中赋予。
例如,若二维数组中的值为:
0 1 2 3 4
5 9 7 4 5
4 3 8 3 6
3 5 6 8 7
则函数值为59。
注意:部分源程序已给出。
请勿改动主函数main和其他函数中的任何内容,仅在函数proc的花括号中填入所编写的若干语句。
试题程序:
#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
#define M 4
#define N 5
int proc(int a[M][N])


void main( )

int aa[M]EN]=0, 1, 2, 3, 4, 5, 9, 7.4, 5,
4, 3, 8, 3, 6, (3, 5, 6.8, 7;
int i, j, y;
system("CLS");
printf("The original data is: /n");
for(i=0; i<M; i++)
for(j=0; j<N; j++)
printf("%6d", aa[i][j]);
printf("/n");

y=proc(aa);
printf("/nThc sun: %d/n", y);
printf("/n");

[简答题]编程题下列程序定义了N×N的二维数组,并在主函数中赋值。请编写函数fun( ),函数的功能是:求出数组周边元素的平方和并作为函数值返回给主函数中的s。例如:若a 数组中的值为a=0 1 2 7 91 11 21 5 52 21 6 11 19 7 9 10 25 4 1 4 1则返回主程序后s的值应为310。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:#include #include#include#define N 5int fun (int w[][N]){}main( ){ int a[N][N]={0,1,2,7,9,1,11,21,5,5,2,21,6,11,1,9,7,9,10,2,5,4,1,4,1}; int i, j; int s; clrscr( ); printf("*****The array*****/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,其功能是求出数组的最大元素在数组中的下标并存放在k所指的存储单元中。
例如,输入如下整数:
876 675 896 101 301 401 980 431 451 777
则输出结果为:
6,980
注意:部分源程序在文件PROG1.C中,请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入你编写的若干语句。
文件PROG1.C内容如下:
#include<stdio.h>
void fun(int *s,int t,int *k)


void main( )
int a[10]=876,675,896,101,301,401,980,431,451,777,k;
fun(a,10,&k);
printf("The resuh:%d,%d/n",k,a[k]);

[简答题]下列程序定义了N×N的二维数组,并在主函数中赋值。请编写一个函数fun( ),函数的功能是:求数组周边元素的平方和并作为函数值返回给主函数中的值。例如,若数组a中的值为
0  1  2  7  9
1  11  21  5  5
2  21  6  11  1
9  7  9  10  2
5  4  1  4  1
则返回主程序后s的值应为310。
注意:部分原程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
[试题源程序]
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#define N 5
int fun(int w[][N])


main( )

int a[N][N]=0,1,2,7,9,1,11,21,5,5,2,21,6,11,1,9,7,9,10,2,5,4,1,4,1;
int i,j;
int s;
clrscr( );
printf("*****The array*****/n");
for(i=0;i<N;i++)

for(j=0;j<N;j++)

printf("%4d",a[i][j]);

printf("/n");

S=fun(a):
printf("*****THE RESULT*****/n");
printf("The sum is:%d/n",s);

[简答题]请编写一个函数fun( ),它的功能是:求出一个4×M整型二维数组中最小元素的值,并将此值返回调用函数。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仪在函数fun的花括号中填入所编写的若干语句。
试题程序:
#define M 4
#include <stdio.h>
fun (int a[])[M])
main( )

int arr[4][M]=11,3,9,35,42,-4,24,32,6,48,-32,7,23,34,12,-7);
printf("min=%d/n",fun(arr));

[简答题]请编写一个函数fun( ),它的功能是:求出一个2×M整型二维数组中最大元素的值,并将此值返回调用函数。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fan的花括号中填入所编写的若干语句。
试题程序:
#define M 4
#include <stdio.h>
fun(int a[] [M])



main( )

int arr[2][M]=5, 8, 3, 45, 76, -4, 12, 82;
printf("max=%d/n",fun(arr));

[多项选择]编程题 下列程序定义了N×N的二维数组,并在主函数中赋值。请编写函数fun( ),函数的功能是:求出数组周边元素的平方和并作为函数值返回给主函数中的s。例如:若a 数组中的值为 a=0 1 2 7 9 1 11 21 5 5 2 21 6 11 1 9 7 9 10 2 5 4 1 4 1 则返回主程序后s的值应为310。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include #include #include #define N 5 int fun (int w[][N]) { } main( ) { int a[N][N]={0,1,2,7,9,1,11,21,5,5,2,21,6,11,1,9,7,9,10,2,5,4,1,4,1}; int i, j; int s; clrscr( ); printf("*****The array*****/n "); for (i=0; i
[简答题]请编写函数fun( ),该函数的功能是将M行N列的二维数组中的数据,按列的顺序依次放到一维数组中。
例如:二维数组中的数据为
33333333
44444444
55555555
则一维数组中的内容应是
334455334455334455334455。
注意:部分源程序以存在文件test_2.cpp中。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
文件test39_2.cpp的内容如下:
#include<stdio.h>
#include<iostream.h>
void fun(int(*s) [10],int *b, int *n,int mm,int nn)


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;
cout<<"The matrix:/n"
for(i=0; i<3; i++)

for(j=0; j<4; j++
cout<<w[i] [j];
cout<<endl;

fun(w, a, &n, 3, 4);
cout<<"The A array:/n";
for(i=0; i<n; i++)
cout<<a[i];
cout<<"/n/n";

[简答题]请编写函数fun( ),该函数的功能是:将M行N列的二维数组中的数据,按行的顺序依次放到一维数组中,一维数组中数据的个数存放在形参n所指的存储单元中。 例如,若二维数组中的数据为: 33 33 33 33 44 44 44 44 55 55 55 55 则一维数组中的内容应该是33 33 33 33 44 44 44 AA, 55 55 55 55 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include <stdio. h> 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 ("%3d",w[i] [j] ); printf ("/n"); } fun (w,a, &n, 3, 4); printf ("The A array: In"); for(i=0; i<n; i++) printf ("%3d", a [i] ); printf ("/n/n"); }

我来回答:

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

订单号:

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