填空题 C++
题号 #2656961

找出矩阵A3×4中第一个最大元素以及它的行号和列号(从0开始计算)。
#define M  3
#define N  4
#include <iostream>
using namespace std;
int main()
{int i,j,row,colum,max;
int a[M][N];
for(i=0;i<M;i++)
for(j=0;j<N;j++)
      cin>>a[i][j];
max=__1__; row=0,colum=0;  
for (i=0;i<M;i++)
   for(j=0;j<N;j++)
     if (__2__)
       { max=a[i][j];
         row=i;
         colum=j;
       }
cout<<”\nmax=”<<max<<”,row=”<< row<<”,colum=”<<colum<<'\n';
return 0;
}

进入在线模考

参考答案

暂无

答案解析

1:a[0][0]  2:max<a[i][j]  或  a[i][j]>max

你可能感兴趣的试题

找试题 · 找答案 · 找资料 在线模考