模拟试题

3773考试网计算机等级考试模拟试题正文

2014年3月全国计算机二级C语言上机模拟试题五十八1

来源:2exam.com 2013-11-13 11:20:05

给定程序中,函数fun的功能是:在3×4的矩阵中找出在行上最大、在列上最小的那个元素,若没有符合条件的元素则输出相应信息。 

  例如,有下列矩阵: 

  1 2 13 4 

  7 8 10 6 

  3 5 9 7 

  程序执行结果为:find: a[2][2]=9 

  请在程序的下划线处填入正确的内容并把下划线删除, 使程序得出正确的结果。 

  注意:源程序存放在考生文件夹下的BLANK1.C中。 

  不得增行或删行,也不得更改程序的结构! 

  给定源程序: 

  #include  

  #define M 3 

  #define N 4 

  void fun(int (*a)[N]) 

  { int i=0,j,find=0,rmax,c,k; 

  while( (i  { rmax=a[i][0]; c=0; 

  for(j=1; j  if(rmax  rmax=a[i][j]; c= __1__ ; } 

  find=1; k=0; 

  while(k  if (k!=i && a[k][c]<=rmax) find= __2__ ; 

  k++; 

  } 

  if(find) printf("find: a[%d][%d]=%d\n",i,c,a[i][c]); 

  __3__ ; 

  } 

  if(!find) printf("not found!\n"); 

  } 

  main() 

  { int x[M][N],i,j; 

  printf("Enter number for array:\n"); 

  for(i=0; i  for(j=0; j  printf("The array:\n"); 

  for(i=0; i  { for(j=0; j

触屏版 电脑版
3773考试网 琼ICP备12003406号-1