代码如下,仅供参考:
#include
using namespace std;
int main()
{
int i,j,min,max,a[3][4],b[24],c[24],m=0,n=0;
cout<<"请输入矩阵元素:"<
for(j=0;j<4;j++)
cin>>a[i][j];
min=max=a[0][0];
for(i=0;i<3;i++)
for(j=0;j<4;j++)
{
if(min>a[i][j])
min=a[i][j];
if(max max=a[i][j];
}
for(i=0;i<3;i++)//假如最值有相同的时候,进行检验并记录。
for(j=0;j<4;j++)
{
if(max==a[i][j])
{
b[m]=i;
m++;
b[m]=j;
m++;
}
if(min==a[i][j])
{
c[n]=i;
n++;
c[n]=j;
n++;
}
}
cout<<"矩阵元素最大值为:"<
}
有不清楚的再联系我。
Private Sub Command1_Click()
Dim a(2, 3) As Double
Dim i As Integer, j As Integer, m As Integer, n As Integer
Randomize
For i = 0 To 2
For j = 0 To 3
a(i, j) = Int(Rnd * 1000)
If a(i, j) > a(m, n) Then m = i: n = j
Print a(i, j);
Next j
Print
Next i
Print "最大的数是:"; m + 1; "行"; n + 1; "列的"; a(m, n)
End Sub
#include
void main()
{
int a[3][4],i,j,x,y,z;
for(i=1;i<=3;i++)
for(j=1;j<=4;j++)
scanf("%u",&a[i][j]);
x=1;y=1;z=a[1][1];
for(i=1;i<=3;i++)
for(j=1;j<=4;j++)
if(a[i][j]>a[x][y])
{
x=i;y=j;z=a[i][j];
}
printf("%u %u",x,y);
printf("%u",z);
}
要说明有用啥语言啊?