设为首页 加入收藏

TOP

2011年计算机二级C语言上机操作题及答案(74)
2014-11-22 20:00:17 来源: 作者: 【 】 浏览:20
Tags:2011年 计算机 二级 语言 上机 操作 答案

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


请勿改动主函数main和其它函数中的任何内容,仅在fun函数的横线上填入所编写的若干表达式或语句。


#include


typedef struct


{


char name[10];


int age;


} STD;


STD fun(STD std[], int n)


{


STD max;


int i;


max = ___1___;


for (i=1; i 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");


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


}


编辑特别推荐:


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇2011年计算机二级C语言上机操作题.. 下一篇2011年计算机二级C语言上机操作题..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: