```c++
/*有N名学生,每个人的信息包括学号、姓名和语文、数学、英语、平均分等内容(用结构体表示 ),输出平均分排名倒数第2的学生信息。*/
#include<stdio.h>
struct Student
#define N 4 //定义学生数量N为4
{
char name[20]; //姓名
int num; //学号
float score[3]; //语文,数学,英语三门课的成绩
float aver; //平均成绩
};
int main()
{
int n,m;
float f[20];
void input(struct Student stu[]); //对两个函数进行声明
struct Student stu[N],*p = stu; //定义结构体数组和指针
input(p);
printf("平均成绩倒数第二的学生是:\n");
printf("学号:%d\n姓名:%s\n三门课的成绩:%5.lf,%5.lf,%5.lf\n平均成绩为:%6.2f\n",stu[N-1].num,stu[N-1].name,stu[N-1].score[0],stu[N-1].score[1],stu[N-1].score[2],stu[N-1].aver);
return 0;
}
void input(struct Student stu[])
{
int i;
printf("请输入学生的学号、姓名和三门课的成绩:\n");
for (i = 0; i < N; i++)
{
scanf("%d %s %f %f %f", &stu[i].num, stu[i].name, &stu[i].score[0], &stu[i].score[1], &stu[i].score[2]); //输入相关信息进行处理
stu[i].aver = (stu[i].score[0] + stu[i].score[1] + stu[i].score[2]) / 3.0; //计算平均值
}
}