From 137aa87c462a20584f9c9a424e10f2b6a7e07a98 Mon Sep 17 00:00:00 2001 From: pbs89iory Date: Sun, 12 Nov 2023 10:09:52 +0800 Subject: [PATCH] ADD file via upload --- 8.c | 183 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 8.c diff --git a/8.c b/8.c new file mode 100644 index 0000000..0d20bfc --- /dev/null +++ b/8.c @@ -0,0 +1,183 @@ +#include +int j=0,q=-1; +char e; +struct st + { + int xh; + int bj; + char xm[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 %.1f %.1f %.1f",&st[j].xh,&st[j].bj,&st[j].xm,&st[j].gs,&st[j].dw,&st[j].yy); + printf("continue?\n"); + scanf("%*[^\n]"); + scanf("%*c"); + scanf("%c",&e); + j++; + if(e=='n') + { + return; + } + else if(e=='y') + { + input(); + } +} +void delete() +{ + 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') + { + output(); + } + if(mm=='y') + { + gets(s); + for(f=0;fst[i].bj) + { + struct st 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].bj==st[q].bj) + { + struct st 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