输入3*3的整形数组,找到一个元素,是所在行里面最大的,所在列里面最小的,
没有的话就显示无吧,数组为
1 2 3
4 5 6
7 8 9
真没想出来,书答案也没看懂,给个答案(关键地方给下解释)
程序代码:#include<stdio.h>
#define M 3
#define N 3
int main()
{
int i,j;
int location1;
int location2;
int find=0;
int a[M][N];
printf("please input the vlaues of the arry\n");
for(i=0;i<M;i++)
{
for(j=0;j<N;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<M;i++)
{
for(location1=0,j=0;j<N;j++)
{
if(a[i][location1]<a[i][j])
location1=j;
}
for(location2=0,j=0;j<M;j++)
{
if(a[location2][location1]>a[j][location1])
{
location2=j;
}
}
if(location2==i)
{
find=1;
printf("a[%d][%d] is the value that we want!\n",location2,location1);
}
if(!find)
{
printf("Can not find!\n");
}
}
return 0;
}可以运行!

程序代码:#include<stdio.h>
#define M 3
#define N 3
int main()
{
int i,j;
int location1;
int location2;
int find=0;
int a[M][N];
printf("please input the vlaues of the arry\n");
for(i=0;i<M;i++)//输入数组值
{
for(j=0;j<N;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<M;i++)
{
for(location1=0,j=0;j<N;j++)//寻找行最大
{
if(a[i][location1]<a[i][j])
location1=j;
}
for(location2=0,j=0;j<M;j++)//寻找列最小
{
if(a[location2][location1]>a[j][location1])
{
location2=j;
}
}
if(location2==i)//如果寻找的行符合条件的话
{
find=1;
printf("a[%d][%d] is the value that we want!\n",location2,location1);//输出它的位置
}
if(!find)
{
printf("Can not find!\n");
}
}
return 0;
}还有不懂得再说。。。。

