From 9a47f44faa59b75493b91b476d87822ff5322de0 Mon Sep 17 00:00:00 2001 From: p72fupixj Date: Sun, 5 Nov 2023 15:19:49 +0800 Subject: [PATCH] ADD file via upload --- 7.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 7.c diff --git a/7.c b/7.c new file mode 100644 index 0000000..0569935 --- /dev/null +++ b/7.c @@ -0,0 +1,115 @@ +#include +#include +#define N 7 + +struct stu_info +{ + int num,cls; + char name[20]; + float math,physics,english; +}; + +struct stu_info stu[N]={{10001,11,"Zhang",99.5,88.5,89.5}, + {10002,12,"Yang",77.9,56.5,87.5}, + {10003,11,"Liang",92.5,99.0,60.5}, + {10004,11,"Cai",89.6,56.9,90.5}, + {10005,14,"Fu",55.6,67.9,98.9}, + {10006,12,"Mao",22.1,45.9,99.2}, + {10007,13,"Zhan",35.6,67.9,88.0}}; + +void sort(struct stu_info *stu,int n) +{ + int i,j; + struct stu_info tmp; + for(i=0;icls>(stu+j+1)->cls)||((stu+j)->cls==(stu+j+1)->cls)&&((stu+j)->num>(stu+j+1)->num)) + { + tmp = *(stu+j); + *(stu+j) = *(stu+j+1); + *(stu+j+1) = tmp; + } + } + } + return; +} + +void s_cls() +{ + int to,from,i; + scanf("%d-%d",&to,&from); + for(i=0;i=lim) printf("%d %d %s %.1f %.1f %.1f\n",stu[i].num,stu[i].cls,stu[i].name,stu[i].math,stu[i].physics,stu[i].english); + } +} + +void s_cls_num() +{ + int key,to,from,i; + scanf("%d.%d-%d",&key,&to,&from); + for(i=0;i