以下fun函数的功能是在N行M列的整型二维数组中,选出一...
以下fun函数的功能是在N行M列的整型二维数组中,选出一个最大值作为函数值返回,请填空。(设M,N已定义)
int fun(int a[N][M])
{int i,j,row=0,col=0;
for(i=0;i
for(j=0;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;i
for(j=0;j
if(a[i][j]>a[row][col])(row=i;col=j;)
return(_____);
}
第1题
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(_____);
}
第2题
include<iostream>
define N 3
define M 3
using 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;
}
第3题
#define N 3
#define M 3
select(int a[N][M],int *n)
(int i,j,row=1,colum=1;
for(i=0;i<N:i++)
for(j=0;j<M; j++)
if(a[i][j]>a[row][colum]){row=i;colum=j;}
*n=______;
return______:
}
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);
}
第4题
例如:二维数组中的数据为
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";
}
第5题
注意:部分源程序给出如下。
请勿改动主函数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));
}
第6题
第7题
第8题
第9题
第10题
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!