当前所在位置:珠峰网资料 >> 计算机 >> 计算机等级考试 >> 正文
2015年计算机二级C语言50套程序填空上机题(37)
发布时间:2011/11/1 9:43:29 来源:城市学习网 编辑:ziteng

  37、给定程序中,函数fun的功能是:将形参std所指结构体数组中年龄最大者的数据作为函数值返回,并在main函数中输出。

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

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

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

  #include    

  typedef  struct

  {  char  name[10];

     int  age;

  }STD;

  STD fun(STD  std[], int  n)

  {  STD  max;        int  i;

  /**********found**********/

     max= ___1___;

     for(i=1; i  /**********found**********/

       if(max.age<___2___)  max=std[i];

     return max;

  }

  main( )

  {  STD  std[5]={"aaa",17,"bbb",16,"ccc",18,"ddd",17,"eee",15  };

     STD  max;

     max=fun(std,5);

     printf("\nThe result: \n");

  /**********found**********/

     printf("\nName : %s,   Age :  %d\n", ___3___,max.age);

  }

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved