main
p49a3zeks 2 years ago
parent 3efb9a8776
commit f925f1539c

56
step5

@ -0,0 +1,56 @@
#include<stdio.h>
#include<string.h>
#define size 3
int main()
{
//我们假设此处已有学生的信息
//此处排序函数在4中已有函数名sequence
struct Student
{
int class;//[size];
int number, score;
int ans;
int score1, score2, all_score;//三门成绩分别为scorescore1score2all_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;
}
Loading…
Cancel
Save