- 奖学金
- 2009-11-03 17:50:53 @
#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 条评论
目前还没有评论...