文章

1

粉丝

10

获赞

0

访问

126

头像
成绩排序问题-1151
我要提问
发布于2024年3月22日 12:47
阅读数 126

我的代码如下 提交后数据通过率为66% 检查错误数据对比也没看到哪里有错

我自己看不出哪里有问题 请大佬帮忙看看~谢谢您angel

#include<stdlib.h>
#include<iostream>
#include<string.h>
using namespace std;

typedef struct student{
    char name[20];
    int score;    
    int number;
};
int cmp1(const void * a, const void* b)
{
    student stu1 = *(student*)a;
    student stu2 = *(student*)b;
    if(stu1.score != stu2.score)
        return stu2.score - stu1.score;
    else 
        return stu1.number - stu2.number;
}
int cmp2(const void * a, const void* b)
{
    student stu1 = *(student*)a;
    student stu2 = *(student*)b;
    if(stu1.score != stu2.score)
        return stu1.score - stu2.score;
    else
     &...

登录查看完整内容


登录后发布评论

2 条评论
snake VIP
2024年3月22日 13:54

题目说了多组测试数据输入

改为

while(cin >> n >> m)

赞(0)

liujia : 回复 snake: 是的 感谢您~

2024年3月22日 15:57