From 1eb6870aa21910f38e3f494586b286792b03af14 Mon Sep 17 00:00:00 2001 From: p6twphb5c <1281646536@qq.com> Date: Mon, 13 Nov 2023 22:02:20 +0800 Subject: [PATCH] ADD file via upload --- E2.step7.c | 154 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 E2.step7.c diff --git a/E2.step7.c b/E2.step7.c new file mode 100644 index 0000000..4c8dba4 --- /dev/null +++ b/E2.step7.c @@ -0,0 +1,154 @@ +#include +#include > +int j=0,q=-1; +char e; +struct stu + { + int id; + int sclass; + char name[10]; + float gs; + float dw; + float yy; + }st[100]; +void input() +{ + printf("id "); + printf("class "); + printf("name "); + printf("score1 "); + printf("score2 "); + printf("score3\n"); + scanf("%d %d %s %f %f %f",&st[j].id,&st[j].sclass,&st[j].name,&st[j].gs,&st[j].dw,&st[j].yy); + printf("continue?\n"); + scanf("%*[^\n]"); + scanf("%*c"); + scanf("%c",&e); + j++; + if(e=='n'||e=='N') + { + return; + } + else if(e=='y'||e=='Y') + { + input(); + } +} +void cdelete() +{ + int i,f,m=5,n; + char mm,s[10]; + printf("Are you sure\n"); + scanf("%*[^\n]"); + scanf("%*c"); + scanf("%c\n",&mm); + if(mm=='n'||mm=='N') + { + output(); + } + if(mm=='y'||mm=='Y') + { + gets(s); + for(f=0;fst[i].sclass) + { + struct stu temp; + temp=st[i]; + st[i]=st[q]; + st[q]=temp; + } + } + if(q==j-1) + { + q=-1; + return; + } + inorder(); +} +void corder() +{ + float a,b; + int i; + q++; + for(i=q+1;ib&&st[i].sclass==st[q].sclass) + { + struct stu temp; + temp=st[i]; + st[i]=st[q]; + st[q]=temp; + } + } + if(q==j) + { + q=-1; + return; + } + else corder(); +} +void order() +{ + inorder(); + corder(); +} +void output() +{ + int l=0; + for(l=0;l