diff --git a/学籍管理系统步骤6.c b/学籍管理系统步骤6.c new file mode 100644 index 0000000..c55e7f8 --- /dev/null +++ b/学籍管理系统步骤6.c @@ -0,0 +1,73 @@ +#include +#include +#define N 3 + +struct stu_info +{ + char num[10]; + int cls,flag; + char name[10]; + float maths,physics,english; +}; + +struct stu_info stu[N]={{"10001",11,0,"Zhang",99.5,88.5,89.5}, + {"10002",12,0,"Yang",77.9,56.5,87.5}, + {"10003",11,0,"Liang",92.5,99.0,60.5}}; + +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; +} + +int main() +{ + struct stu_info q; + scanf("%s",&q.num); + scanf("%d",&q.cls); + scanf("%s",&q.name); + scanf("%f",&q.maths); + scanf("%f",&q.physics); + scanf("%f",&q.english); + int i; + for(i=0;i