#include
using namespace std;
#define MAX 4 //////如果学过链表就可以不用第一结构体数组
typedef struct stude{
int no;
char name[20];
char sex[3];
int age;
float math;
float computer;
float physic;
float english;
float sum;
float average;
} stu;
void main()
{
stu student[MAX];
///////// 输入成绩
for(int i =0; i
cout<<"请输入第"< cout<<"学号:";
cin>>student[i].no;
cout<
cout<
cout<
cout<
cout<
cout<
cout<
cout<
student[i].sum = student[i].math + student[i].computer + student[i].physic +
student[i].english;
///////求平均分
student[i].average = student[i].sum / 4;
}
///////按总分排序 ,用冒泡法
for(int j = 0 ; j < MAX - 1; j++)
{
for(int k =0; k < MAX - 1 - j; k++)
{
if(student[k].sum < student[k+1].sum)
{
float tem;
tem = student[k].sum;
student[k].sum = student[k+1].sum;
student[k+1].sum = tem;
}
}
}
cout<<"学号 "<<"姓名 "<<"性别 "<<"年龄 "<<"高数 "<<"计算机 "<<"物理 "<<"英语 "<<"总分 "<<"平均分"<
{
cout<
}