From f925f1539c9431c0de8da090a9f4df9b66a206fb Mon Sep 17 00:00:00 2001 From: p49a3zeks <1346664542@qq.com> Date: Sun, 12 Nov 2023 22:08:10 +0800 Subject: [PATCH] Add step5 --- step5 | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 step5 diff --git a/step5 b/step5 new file mode 100644 index 0000000..fc24528 --- /dev/null +++ b/step5 @@ -0,0 +1,56 @@ +#include +#include +#define size 3 +int main() +{ + + //我们假设此处已有学生的信息 + //此处排序函数,在4中已有,函数名sequence() + struct Student + { + int class;//[size]; + int number, score; + int ans; + int score1, score2, all_score;//三门成绩分别为score,score1,score2,all_score为了求和 + }Student[size]; + Student[0].class = 11; + Student[1].class = 11; + Student[2].class = 12; + Student[0].number = 10001; + Student[1].number = 10002; + Student[2].number = 10004; + Student[0].score = 90; Student[0].score1 = 90; Student[0].score2 = 90; + Student[1].score = 83; Student[1].score1 = 84; Student[1].score2 = 85; + Student[2].score = 83; Student[2].score1 = 70; Student[2].score2 = 90; + int num=10001; + char choic; + //scanf_s("%c", &choice); + printf("请输入你想删除的学生的编号"); + ; scanf_s("%d", &num); + printf("\n"); + printf("Are you sure(yes/no)\n"); + getchar(); + scanf_s("%c", &choic); + if(choic=='y') + { + for (int count1 = 0; count1 < size; count1++) + { + if (num == Student[count1].number) + continue; + else + { + printf("%d %d %d %d %d ", Student[count1].class, Student[count1].number, Student[count1].score, Student[count1].score1, Student[count1].score2); + } + printf("\n"); + } + } + else + { + for (int count1 = 0; count1 < size; count1++) + { + printf("%d %d %d %d %d ", Student[count1].class, Student[count1].number, Student[count1].score, Student[count1].score1, Student[count1].score2); + printf("\n"); + } + } + return 0; +}