-->
当前位置:首页 > 题库 > 正文内容

函数题:a-4

Luz4年前 (2021-12-27)题库846
完成函数myfun(),使程序能够实现如下要求:编程求出一个正整数3x3矩阵的最大和最小元素及其下标,矩阵中各元素不同。

### 函数接口定义:
c++
void myfun(int inputdata[3][3]);




### 裁判测试程序样例:
c++
#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
void myfun(int inputdata[3][3]);


int main(int argc, char *argv[]) {
int a[3][3];
int i,j;
for(i= 0;i<3;i++)
for(j = 0;j < 3; j++)
scanf("%d", &a[i][j]);
myfun(a);
return 0;
}

/* 请在这里填写答案 */


### 输入样例:

在这里给出一组输入。例如:

in
1 2 3 4 5 6 7 8 9


### 输出样例:

在这里给出相应的输出。例如:

out
max data is 9, pos x is 2, pos y is 2
min data is 1, pos x is 0, pos y is 0







答案:若无答案欢迎评论

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。