函数题:查找数组每行的最大值
本题要求实现:找出任意的一个m×n矩阵每一行上的最大值并按样例格式要求显示。其中:m、n满足(2<=m<=20、2<=n<=20)及矩阵元素从键盘输入。
### 函数接口定义:
c++
void max_row(int arr[][20], int m, int n);
max_row函数输出矩阵各行的最大值,其中m,n为欲处理矩阵的行、列值,
### 裁判测试程序样例:
c++
#include <stdio.h>
void max_row(int arr[][20], int m, int n);
int main(void)
{
int m, n;
int hang, lie, juZhen[20][20];
scanf("%d%d", &m, &n);
for (hang = 0; hang < m; hang++)
{
for (lie = 0; lie < n; lie++)
{
scanf("%d", &juZhen[hang][lie]);
}
}
max_row(juZhen, m, n);
return 0;
}
/* 请在这里填写答案 */
### 输入样例:
在这里给出一组输入。例如:
in
5 6
31 42 36 74 235 88
144 32 57 37 43 47
97 51 257 7 445 459
33 65 44 3 425 43
68 342 82 789 123 213
### 输出样例:
在这里给出相应的输出。例如:
out
The max in line 1 is: 235
The max in line 2 is: 144
The max in line 3 is: 459
The max in line 4 is: 425
The max in line 5 is: 789
answer:若无答案欢迎评论
### 函数接口定义:
c++
void max_row(int arr[][20], int m, int n);
max_row函数输出矩阵各行的最大值,其中m,n为欲处理矩阵的行、列值,
### 裁判测试程序样例:
c++
#include <stdio.h>
void max_row(int arr[][20], int m, int n);
int main(void)
{
int m, n;
int hang, lie, juZhen[20][20];
scanf("%d%d", &m, &n);
for (hang = 0; hang < m; hang++)
{
for (lie = 0; lie < n; lie++)
{
scanf("%d", &juZhen[hang][lie]);
}
}
max_row(juZhen, m, n);
return 0;
}
/* 请在这里填写答案 */
### 输入样例:
在这里给出一组输入。例如:
in
5 6
31 42 36 74 235 88
144 32 57 37 43 47
97 51 257 7 445 459
33 65 44 3 425 43
68 342 82 789 123 213
### 输出样例:
在这里给出相应的输出。例如:
out
The max in line 1 is: 235
The max in line 2 is: 144
The max in line 3 is: 459
The max in line 4 is: 425
The max in line 5 is: 789
answer:若无答案欢迎评论