请大家帮忙看一下这个程序

#include

class student

{

public:

int yuwen;

int shuxue;

int yinyu;

int total;

int num;

};

int cmp(const void *a,const void *b)

{

student *first,*second;

first=(struct student *)a;

second=(struct student *)b;

student m1,m2;

m1=*first;

m2=*second;

if(m1.total>m2.total)return 1;

else return -1;

}

main()

{

int n,i;

cin>>n;

student temp;

student stu[n];

for(i=0;i>stu[i].yuwen>>stu[i].shuxue>>stu[i].yinyu;

stu[i].total=stu[i].yuwen+stu[i].shuxue+stu[i].yinyu;

stu[i].num=i+1;

}

qsort(stu,n,sizeof(student),cmp);

for(i=n-1;i>=n-5;i--)

{

cout

0 条评论

目前还没有评论...

信息

ID
1398
难度
4
分类
其他 | 排序 点击显示
标签
递交数
6447
已通过
2665
通过率
41%
被复制
22
上传者