请将上述代码中的注释去掉
时间: 2023-09-02 20:09:40 浏览: 102
删除代码中的注释
5星 · 资源好评率100%
好的,这是去掉注释的代码:
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_N 50
#define MAX_ID_LEN 10
typedef struct {
char id[MAX_ID_LEN+1];
double score;
} Student;
int cmp(const void *a, const void *b) {
Student *s1 = (Student *)a;
Student *s2 = (Student *)b;
if (s1->score < s2->score) {
return 1;
} else if (s1->score > s2->score) {
return -1;
} else {
return strcmp(s1->id, s2->id);
}
}
int main() {
int n, i;
Student students[MAX_N];
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%s %lf", students[i].id, &students[i].score);
}
qsort(students, n, sizeof(Student), cmp);
for (i = 0; i < n; i++) {
printf("%s %.1lf\n", students[i].id, students[i].score);
}
return 0;
}
```
阅读全文