请编写函数int fun ,a是一个M行N列的二维数组,函数的功能是求出二维数组周边元素之和,作为函数值返回.#include <conio.h>#include <stdio.h>#define M 4#define N 5int fun ( int a[M][N] ){ }NONO( ){/* 请
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/29 01:40:27
![请编写函数int fun ,a是一个M行N列的二维数组,函数的功能是求出二维数组周边元素之和,作为函数值返回.#include <conio.h>#include <stdio.h>#define M 4#define N 5int fun ( int a[M][N] ){ }NONO( ){/* 请](/uploads/image/z/2717348-68-8.jpg?t=%E8%AF%B7%E7%BC%96%E5%86%99%E5%87%BD%E6%95%B0int+fun+%2Ca%E6%98%AF%E4%B8%80%E4%B8%AAM%E8%A1%8CN%E5%88%97%E7%9A%84%E4%BA%8C%E7%BB%B4%E6%95%B0%E7%BB%84%2C%E5%87%BD%E6%95%B0%E7%9A%84%E5%8A%9F%E8%83%BD%E6%98%AF%E6%B1%82%E5%87%BA%E4%BA%8C%E7%BB%B4%E6%95%B0%E7%BB%84%E5%91%A8%E8%BE%B9%E5%85%83%E7%B4%A0%E4%B9%8B%E5%92%8C%2C%E4%BD%9C%E4%B8%BA%E5%87%BD%E6%95%B0%E5%80%BC%E8%BF%94%E5%9B%9E.%23include+%26lt%3Bconio.h%26gt%3B%23include+%26lt%3Bstdio.h%26gt%3B%23define++M++4%23define++N++5int++fun+%28+int+a%5BM%5D%5BN%5D+%29%7B+%7DNONO%28+%29%7B%2F%2A+%E8%AF%B7)
请编写函数int fun ,a是一个M行N列的二维数组,函数的功能是求出二维数组周边元素之和,作为函数值返回.#include <conio.h>#include <stdio.h>#define M 4#define N 5int fun ( int a[M][N] ){ }NONO( ){/* 请
请编写函数int fun ,a是一个M行N列的二维数组,函数的功能是求出二维数组周边元素之和,作为函数值返回.
#include <conio.h>#include <stdio.h>#define M 4#define N 5int fun ( int a[M][N] ){ }NONO( ){/* 请在此函数内打开文件,输入测试数据,调用 fun 函数, 输出数据,关闭文件.*/ int i,j,y,k,aa[M][N] ; FILE *rf,*wf ; rf = fopen("bc4.in","r") ; wf = fopen("bc4.out","w") ; for(k = 0 ; k < 10 ; k++) { for(i = 0 ; i < M ; i++) for(j = 0 ; j < N ; j++) fscanf(rf,"%d",&aa[i][j]) ; y = fun ( aa ); fprintf(wf,"%d\n",y) ; } fclose(rf) ; fclose(wf) ;}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; 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 = fun ( aa ); printf( "\nThe sum: %d\n" ,y ); printf("\n"); NONO( );}
请编写函数int fun ,a是一个M行N列的二维数组,函数的功能是求出二维数组周边元素之和,作为函数值返回.#include <conio.h>#include <stdio.h>#define M 4#define N 5int fun ( int a[M][N] ){ }NONO( ){/* 请
我已经测试 结果61!
int fun ( int a[M][N] )
{
int i,j,sum=0;
for(i=1;i