模拟试题

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

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

来源:2exam.com 2013-11-14 20:12:19

函数fun的功能是:从三个形参a,b,c中找出中间的那个数,作为函数值返 

  回。 

  例如,当a=3, b=5, c=4时,中数为4。 

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

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

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

  给定源程序: 

  #include  

  int fun(int a, int b, int c) 

  { 

  int t; 

  t = (a>b) ? (b>c? b :(a>c?c:___1___)) : ((a>c)?___2___ : ((b>c)?c:___3___)); 

  return t; 

  } 

  main() 

  { int a1=3, a2=5, a3=4, r; 

  r = fun(a1, a2, a3); 

  printf("\nThe middle number is : %d\n", r); 

  }

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