给定程序BLANK1.C中,函数fun的功能是在数组中

给定程序BLANK1.C中,函数fun的功能是在数组中找出两科成绩之和最高的学生并返回其在数组中的下标。对所给函数int fun(STU*d,int n),主函数传给形参d的是学生数组名,而传给形参n的是该数组中学生的个数。

例如,若学生数组数据为:

2016500301李清水83 92

2016500336 刘世才85 94

2016500371王子晨88 88

则调用该函数后,程序输出为:2016500336刘世才85 94

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

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

#include<stdio.h>
typedef struct stu
{
	char ID[30];
	char name[20];
	int score[2];
} STU;
int fun(STU *d,int n)
{
	int i,m;
	/******found******/
	______(1)______;
	for(i=1;i<n;i++)
	/******found******/
		if(d[i].score[0]+d[i].score[1]>________(2)________)
			m=i;
	/******found******/
	______(3)______;
}

void main()
{
	STU a[10]={ "2016500301","李清水",83,92,"2016500336","刘世才",85,94,"2016500371","王子晨",88,88};
	int i,n=3;
	i=fun(a,n);
	printf("%30s%20s%4d%4d",a[i].ID,a[i].name,a[i].score[0],a[i].score[1]);
	printf("\n");
}


答案
第1空:m=0
第2空:d[m].sore[0]+d[m].sore[1]
第3空:return m

题目信息

题号:6718
题型:填空题
难度:普通