diff --git a/7.c b/7.c new file mode 100644 index 0000000..9737e5e --- /dev/null +++ b/7.c @@ -0,0 +1,136 @@ +#include +#include +int cnt=0; +struct student{ + int clas; + char id[20],name[20]; + double score1,score2,score3,total; +}s[10]; + +void input(){ + int i,j; + for(i=0;i<7;i++){ + scanf("%s%d%s%lf%lf%lf",s[i].id,&s[i].clas,s[i].name,&s[i].score1,&s[i].score2,&s[i].score3); + cnt++; + s[i].total=s[i].score1+s[i].score2+s[i].score3; + } + +} + +void select(){ + int n,i,j; + scanf("%d",&n); + if(n==1){ + int clas1,clas2; + scanf("%d-%d",&clas1,&clas2); + for(i=0;i=clas1&&s[i].clas<=clas2){ + output(i); + } + } + } + else if(n==2){ + char range[40],id1[20],id2[20]={}; + scanf("%s",range); + for(i=0;i=0&&strcmp(s[i].id,id2)<=0){ + output(i); + } + } + } + else if(n==3){ + char capital[20]; + scanf("%s",capital); + for(i=0;i=score) output(i); + } + } + else if(n==5){ + int clas; + char range[40],id1[20]={},id2[20]={}; + scanf("%s",range); + clas=10*(range[0]-'0')+range[1]-'0'; + for(i=0;i=0&&strcmp(s[i].id,id2)<=0){ + output(i); + } + } + } + +} + +void order(){ + int i,j; + for(i=0;is[j+1].clas||(s[j].clas==s[j+1].clas&&s[j].total