#include
#include
#define STU_NUM 10 /*宏定义学生的数量*/
struct student /*定义一个结构体用来存放学生学号、三门课成绩、总分及平均成绩*/
{
char stu_id[20]; /*学生学号;*/
float score[3]; /*三门课成绩;*/
float total; /*总成绩;*/
float aver; /*平均成绩;*/
};
/*排序用一个函数来实现*/
void SortScore(student *stu,int n)
{
student stud;
for(int i = 0; i < n-1; i++)
for(int j = i+1 ; j < n; j++)
{
if(stu[i].total < stu[j].total)
{
stud = stu[i];
stu[i] = stu[j];
stu[j] = stud;
}
}
}
int main( )
{
student stu[STU_NUM]; /*创建结构体数组中有10个元素,分别用来保存这10个人的相关信息。*/
/*输入这十个学生的相关信息*/
for(int i = 0; i
{
printf("请输入第%d个学生的学