ch27-1.c

来自「C语言程序设计上机指导与练习 冶金工业出版社 刘怀亮」· C语言 代码 · 共 44 行

C
44
字号
#define N 20 
#define M 20 
#include<stdio.h> 
#include<conio.h> 

void main( ) 
{ 
   int a[N][M]; /*int a[][]; not allowed here */
   int i,j,k,row,col,n,m,find=0; 
   clrscr(); 
   printf("\nEnter n & m:\n\n"); 
   scanf("%d%d",&n,&m); 
   printf("\nEnter a[0][0]--a[%d][%d]\n\n",n-1,m-1); 
   for(i=0;i<n;i++) 
      for(j=0;j<m;j++)
         scanf("%d",&a[i][j]); 
   printf("\n\nThe array you have just entered is:\n"); 
   for(i=0;i<n;i++) 
   { 
      for(j=0;j<m;j++) 
         printf("%5d",a[i][j]); 
      printf("\n\n"); 
   } 

   /*find the point */
   for(i=0;i<n;i++) 
   { 
      for(col=0,j=1;j<m;j++) 
         if(a[i][col]<a[i][j]) /*find col,select sort according to col*/
            col=j; 
      for(row=0,k=1;k<n;k++) 
         if(a[row][col]>a[k][col]) /*find row,select sort according to row*/
            row=k; 
      if(i==row) 
      { 
         find=1; 
         printf("The point is a[%d][%d].\n",row,col);
      } 
   }
   if(!find) 
      printf("\nNo solution.\n"); 
   getch(); 
} 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?