mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-12-16 15:44:39 +00:00
19 lines
395 B
C
19 lines
395 B
C
int set_grade(struct student *p, int n) {
|
|
int cnt = 0;
|
|
|
|
for (int i = 0; i < n; i++) {
|
|
if (p[i].score >= 85) {
|
|
p[i].grade = 'A';
|
|
} else if (p[i].score >= 70) {
|
|
p[i].grade = 'B';
|
|
} else if (p[i].score >= 60) {
|
|
p[i].grade = 'C';
|
|
} else {
|
|
p[i].grade = 'D';
|
|
cnt++;
|
|
}
|
|
}
|
|
|
|
return cnt;
|
|
}
|