From d97c47e36a213c5c0ce6346f0faeee6fbd7d6023 Mon Sep 17 00:00:00 2001 From: pr9nfksyw Date: Fri, 22 Nov 2024 20:34:30 +0800 Subject: [PATCH] Delete 'order_other_opinion.c' --- order_other_opinion.c | 131 ------------------------------------------ 1 file changed, 131 deletions(-) delete mode 100644 order_other_opinion.c diff --git a/order_other_opinion.c b/order_other_opinion.c deleted file mode 100644 index cf5af92..0000000 --- a/order_other_opinion.c +++ /dev/null @@ -1,131 +0,0 @@ -#include -#include -#include -#include -#include -#include "menu.h" - -void insertStudentInfo(Student students[], int* count) { - if (*count >= MAX_STUDENTS) { - printf("学生已满,无法添加新学生。\n"); - return; - } - - Student newStudent; - int validInput; - - do { - validInput = 1; - printf("Id: "); - scanf_s("%9s", newStudent.id, (unsigned)_countof(newStudent.id)); - - // 验证学号是否只由数字组成 - for (int i = 0; i < strlen(newStudent.id); i++) { - if (!isdigit(newStudent.id[i])) { - validInput = 0; - break; - } - } - - if (!validInput) { - printf("学号只能由数字组成,请重新输入。\n"); - } - } while (!validInput); - - printf("Class: "); - scanf_s("%9s", newStudent.clas, (unsigned)_countof(newStudent.clas)); - printf("Name: "); - scanf_s("%9s", newStudent.name, (unsigned)_countof(newStudent.name)); - printf("Score1: "); - scanf_s("%lf", &newStudent.score1); - printf("Score2: "); - scanf_s("%lf", &newStudent.score2); - printf("Score3: "); - scanf_s("%lf", &newStudent.score3); - - newStudent.score = newStudent.score1 + newStudent.score2 + newStudent.score3; - - int i = *count; - while (i > 0 && (strcmp(students[i - 1].clas, newStudent.clas) > 0 || - (strcmp(students[i - 1].clas, newStudent.clas) == 0 && students[i - 1].score < newStudent.score))) { - students[i] = students[i - 1]; - i--; - } - students[i] = newStudent; - (*count)++; -} -void deleteStudentInfo(Student students[], int* count) { - char input[20]; - printf("Enter the student ID or name to delete: "); - scanf_s("%19s", input, (unsigned)_countof(input)); - - int i = 0; - while (i < *count && (strcmp(students[i].id, input) != 0 && strcmp(students[i].name, input) != 0)) { - i++; - } - - if (i == *count) { - printf("Student not found.\n"); - } - else { - for (int j = i; j < *count - 1; j++) { - students[j] = students[j + 1]; - } - (*count)--; - printf("Student deleted successfully.\n"); - } -} - -void modifyStudentInfo(Student students[], int count) { - char input[20]; - printf("Enter the student ID to modify: "); - scanf_s("%19s", input, (unsigned)_countof(input)); - - int i = 0; - while (i < count && strcmp(students[i].id, input) != 0) { - i++; - } - - if (i == count) { - printf("Student not found.\n"); - } - else { - printf("Id: "); - scanf_s("%9s", students[i].id, (unsigned)_countof(students[i].id)); - printf("Class: "); - scanf_s("%9s", students[i].clas, (unsigned)_countof(students[i].clas)); - printf("Name: "); - scanf_s("%9s", students[i].name, (unsigned)_countof(students[i].name)); - printf("Score1: "); - scanf_s("%lf", &students[i].score1); - printf("Score2: "); - scanf_s("%lf", &students[i].score2); - printf("Score3: "); - scanf_s("%lf", &students[i].score3); - - students[i].score = students[i].score1 + students[i].score2 + students[i].score3; // Fixed here - printf("Student information updated successfully.\n"); - } -} - -void queryStudentInfo(Student students[], int count) { - char queryClass[MAX_STRING]; - printf("请输入要查询的班级: "); - scanf_s("%9s", queryClass, (unsigned)_countof(queryClass)); - - printf("查询结果:\n"); - for (int i = 0; i < count; i++) { - if (strcmp(students[i].clas, queryClass) == 0) { - printf("%s %s %s %.1lf %.1lf %.1lf %.1lf\n", students[i].id, students[i].clas, students[i].name, - students[i].score1, students[i].score2, students[i].score3, students[i].score); - } - } -} - - - - - - - -