#include "mysyslib.h" typedef struct Student { char* id; char* clas; char* name; double score1; double score2; double score3; double score; }student; void ModifyInfo(Student stu_info[],int len) { Student new_stu_info; scanf("%s%s%s%lf%lf%lf", new_stu_info.id, new_stu_info.clas, new_stu_info.name, new_stu_info.score1, new_stu_info.score2, new_stu_info.score3); for (int i = 0; i < len; i++) { if (strcmp(new_stu_info.id, stu_info[i].id) == 0) { stu_info[i] = new_stu_info; } } char* max, min; strcpy(max, stu_info[0].clas); strcpy(min, stu_info[0].clas); for (int i = 0; i < len; i++) { if (stu_info[i].clas > max) { strcpy(max, stu_info[i].clas); } if (stu_info[i].clas < min) { strcpy(min, stu_info[i].clas); } } int i = 0, flag = 0; while (strcmp(min, max) != 1) { while (i < len && strcmp(min, stu_info[i++].clas) == 0) { if (flag == 1) { if (strcmp(stu_info[i].id, new_stu_info.id) == 0) { printf(" %s %s %lf %lf %lf modified\n", stu_info[i].id, stu_info[i].name, stu_info[i].score1, stu_info[i].score2, stu_info[i].score3); } else printf(" %s %s %lf %lf %lf\n", stu_info[i].id, stu_info[i].name, stu_info[i].score1, stu_info[i].score2, stu_info[i].score3); } else { flag = 1; if (strcmp(stu_info[i].id, new_stu_info.id) == 0) { printf("%s %s %s %lf %lf %lf modified\n", stu_info[i].clas, stu_info[i].id, stu_info[i].name, stu_info[i].score1, stu_info[i].score2, stu_info[i].score3); } else printf("%s %s %s %lf %lf %lf modified\n", stu_info[i].clas, stu_info[i].id, stu_info[i].name, stu_info[i].score1, stu_info[i].score2, stu_info[i].score3); } } min = min + 1; } }