网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

以下fun函数的功能是在N行M列的整型二维数组中,选出一个最大值作为函数值返回,请填空。(设M,N已定义)

int fun(int a[N][M])

{int i,j,row=0,col=0;

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

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

if(a[i][j]>a[row][col])(row=i;col=j;)

return(_____);

}


参考答案

更多 “ 以下fun函数的功能是在N行M列的整型二维数组中,选出一个最大值作为函数值返回,请填空。(设M,N已定义)int fun(int a[N][M]){int i,j,row=0,col=0;for(i=0;iN;i++)for(j=0;jM;j++)if(a[i][j]a[row][col])(row=i;col=j;)return(_____);} ” 相关考题
考题 以下程序中函数 fun 的功能是:统计 person 所指结构体数组中所有性别 (sex) 为 M 的记录的个数 , 存入变量 n 中,并做为函数值返回。请填空:#include stdio.h#define N 3typedef struct{ int num;char nam[10]; char sex;} SS;int fun(SS person[]){ int i,n=0;for(i=0;iN;i++)if( 【 14 】 =='M') n++;return n;}main(){ SS W[N]={{1, "AA", 'F'},{2, "BB",'M'},{3,"CC", 'M'}}; int n;n=fun(W); printf("n=%d\n",n);}

考题 以下程序中,select函数的功能是:在N行M列的二维数组中,选出一个最大值作为函数值返回,并通过形参传回此最大值所在的行下标,请填空。#define N 3#define M 3select(int a[N][M],int *n){int i,j,row=0,colum=0;for(i=0;iN;i++)for(j=0;jM;j++)if(a[i][j]a[row][colum]){row=i;colum=j;}*n=;return();}

考题 以下程序中的select()函数功能是:在N行M列的二维数组中选出一个最大值作为函数值返回,并通过形参传回此最大值的行下标。请填空完成此程序。include<iostream>define N 3define M 3using namespace std;int select(int a[N][M],int *n){int i,j,row=0,colum=0;for(i=0;i<N;i++)for(i=0;j<M;j++)if(a[i][j]>a[row][colum]){row=i;colum=j;}*n=【 】;return 【 】;}int main(){int a[N][M]={9,11,23,6,1,15,9,17,20};int max,n;max=select(a,n);cout<<"max="<<max<<"line="<<n<<end1;return 0;}

考题 以下程序中,select 函数的功能是:在N行M列的二维数组中,选出一个最大值作为函数值返回,并通过形参传回此最大值所在的行下标。请填空。#define N 3#define M 3select(int a[N][M],int *n){int i,j,row=1,colum=1;for(i=0;ifor(j=0;jif(a[i][j]a[row][colum]){row=i;colum=j;}*n= 【16】 ;return 【17】 ;}main(){int a[N][M]={9,11,23,6,1,15,9,17,20},max,n;max=select(a,n);printf("max=%d,line=%d\n",max,n);}

考题 请编一个函数void fun( int tt[M][N], int pp[N], tt指向一个M行N列的二维数组,求出二维数组每列中最大元素,并依次放入pp所指的一维数组中。二维数组中的数已在主函数中给出。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <conio.h>include <stdio.h>define M 3define N 4void fun(int tt[M][N],int pp[N]){}main(){int t[M] [N]={{68,32,54,12},{14,24,88,58},{42, 22, 44, 56}};int p[N],i,j,k;clrscr();printf("The riginal data is:\n");for(i=0;i<M;i++){for(j=0;j<N;j++)printf("%6d",t[i][j]);printf("\n");}fun(t,p);printf("\nThe result is:\n");for(k=0;k<N;k++)printf("%4d",p[k]);printf("\n");}

考题 以下fun函数的功能是:找出具有N个元素的一维数组中的最小值,并作为函数值返回,请填空。(设N己定义)int fun(int x[N]){int i,k=0for(i=0;iN;i++)if(x[i]x[k])k=_____;return x[k];}

考题 请编写函数fun(),函数的功能是求出二维数组周边元素之和,作为函数值返回。二维数组中的值在主函数中赋予。例如:若二维数组中的值为1 3 5 7 92 9 9 9 46 9 9 9 81 3 5 7 0则函数值为61。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include<conio.h>include<stdio.h>define M 4define N 5int 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的功能是:统计person所指结构体数组中所有性别(sex)为M的记录的个数,存入变量n中,并作为函数值返回。请填空。include <stdio.h>define N 3typedef struct{ int num; char nam[10]; char sex;} SS;int fun(SS person[]){ int i,n=0;for(i=0; i<N; i++)if(【 】=='M') n++;return n;}main(){ SS W[N]={{1,"AA",'F'},{2,"BB",'M'},{3,"CC",'M'}}; int n;n=fun(W); printf("n=%d\n", n);}

考题 以下fun函数的功能是在N行M列的整型二维数组中,选出一个最大值作为函数值返回,请填空。(设M,N已定义) int fun(int a[N][M]) {int i,j,row=0,col=0; for(i=0;i<N;i++) for(j=0;j<M;j++) if(a[i][j]>a[row][col]){row=i;col=j;} return(_____); }