提交时间:2019-12-14 14:24:08

运行 ID: 3194

#include "stdafx.h"//vc++6.0加上这一行.#include "stdio.h" #include "time.h" #include "stdlib.h" void myfun(int (*p)[20],int *po,int *pe){ int i,j; for(i=0;i<10;i++) for(j=0;j<20;j++) if(p[i][j]&1) (*po)+=p[i][j]; else (*pe)+=p[i][j]; } void main(void){ int a[10][20],i,j,o_sum,e_sum; srand((unsigned)time(NULL)); for(o_sum=e_sum=i=0;i<10;i++) for(j=0;j<20;a[i][j++]=rand()/100); myfun(a,&o_sum,&e_sum); printf("The Odd_Sun is %d\nThe Even_Sun is %d\n",o_sum,e_sum); }