typedef struct Score
{
char _name[20];
float _Math;//数学
float _Engl;//英语
float _Comp;//计算机
float _avg;//平均分
}Score;
///获取单个学生的平均分
void GetPeronsalArg(Score &score)
{
score._avg = (score._Math + score._Engl + score._Comp) / 3;
}
///冒泡排序
void Sort(Score scores[], int len)
{
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len - i - 1; j++)
{
if (scores[j]._avg>scores[j + 1]._avg)
{
Score t = scores[j];
scores[j] = scores[j + 1];
scores[j + 1] = t;
}
}
}
}
就写了个简单的方法,你自己测试一下的,有问题再联系
你的学生的基本信息呢?