以下是使用 C 语言解决此问题的代码: ```c #include <stdio.h> #include <string.h> struct student { char no[10]; char name[10]; float score; }; void sortStudents(struct student students[], int n) { struct student temp; for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - i - 1; j++) { if (students[j].score > students[j + 1].score) { temp = students[j]; students[j] = students[j + 1]; students[j + 1] = temp; } } } } int main() { struct student students[5]; for (int i = 0; i < 5; i++) { printf("请输入第%d位同学的信息:姓名 学号 成绩\n", i + 1); scanf("%s%s%f", students[i].name, students[i].no, &students[i].score); } sortStudents(students, 5); for (int i = 0; i < 5; i++) { printf("%s,%s,%.0f\n", students[i].name, students[i].no, students[i].score); } return 0; } ``` [2025-01-01 20:11:47 | AI问答 | 326点数解答]