#include
#include
int main()
{
int i,m,n,*array;
printf("请输入矩阵行数:");
scanf("%d",&m);
printf("请输入矩阵列数:");
scanf("%d",&n);
array=(int*)malloc(m*n*sizeof(int));
printf("请输入该%d*%d矩阵:\n",m,n);
for(i=0;i
int max=array[0];
int index=0;
for(i=1;i
if(max
max=array[i];
index=i;
}
}
printf("您输入的矩阵中的最大值为:%d\n",max);
printf("它所在的行号和列号分别是:%d,%d\n",(index/n)+1,(index%n)+1);
return 0;
}
int main(){
int m=0, n=0,arr[100][100],x1=0,y1=0;
scanf_s("%d%d",&m,&n);
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
scanf_s("%d", &arr[i][j]);
}
}
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
if (arr[i][j]>arr[x1][y1]){
x1 = i;
y1 = j;
}
}
}
printf_s("max=%d\nrow=%d,column=%d\n",arr[x1][y1],x1+1,y1+1);
system("pause");
return 0;
}
这里print_s你可以在VC60里面改成print