From 750a1a682568a73ef5184a39572899f50033768d Mon Sep 17 00:00:00 2001 From: p2q8c7xv9 <2974886065@qq.com> Date: Sat, 11 Nov 2023 19:53:22 +0800 Subject: [PATCH] ADD file via upload --- T2 enrollment management system.c | 283 ++++++++++++++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 T2 enrollment management system.c diff --git a/T2 enrollment management system.c b/T2 enrollment management system.c new file mode 100644 index 0000000..296da35 --- /dev/null +++ b/T2 enrollment management system.c @@ -0,0 +1,283 @@ +#include +#include +#include + +//初始化声明 + +int addnum=0; +struct info{ + int number; + int clas; + char name[20]; + float math; + float physic; + float english; + float grade; +}; +struct info stu[20]; +int judge(); +void swap(int i,int j); +void initial(); +void ind(); +void inputinfop1(); +void deleteinfop2(); +void selectinfop3(); +void rangeinfop4(); +void printinfop5(); + +//主程序 + +int main(){ + initial(); + int in; + while(1){ + ind(); + scanf("%d",&in); + switch(in){ + case 1: + printf("You are trying to Input info\n"); + inputinfop1();break; + case 5: + printf("You are trying to Output info\n"); + printinfop5();break; + case 4: + printf("You are trying to Make things ordered\n"); + rangeinfop4(); + break; + case 6: + printf("You are about to Quit\n");return 0; + case 2:deleteinfop2();break; + case 3:selectinfop3();break; + default: + printf("Wrong input\n");break; + } + } + + return 0; +} + + +//初始化ini + +void initial(){ + int i; + for(i=0;i<20;i++){ + stu[i].number=0; + stu[i].math=0.0; + stu[i].physic=0.0; + stu[i].english=0.0; + stu[i].clas=0; + memset(stu[i].name,0,sizeof(stu[i].name)); + } + return; +} + +//输入步骤 + +void inputinfop1(){ + int j,k,l,temp,num=0; + char str[10]; + float total[2][20]; + memset(total,0,sizeof(total)); + do{ + printf("Id "); + scanf("%d",&stu[addnum].number); + printf("class "); + scanf("%d",&stu[addnum].clas); + printf("name "); + scanf("%s",&stu[addnum].name); + printf("score1 "); + scanf("%f",&stu[addnum].math); + printf("score2 "); + scanf("%f",&stu[addnum].physic); + printf("score3 "); + scanf("%f",&stu[addnum].english); + stu[addnum].grade=stu[addnum].math+stu[addnum].physic+stu[addnum].english; + total[1][addnum]=stu[addnum].grade; + total[0][addnum]=addnum; + addnum++; + num++; + if(judge()){ + continue; + } + else{ + break; + } + }while(1); + //排序 + // + +} + +//rangeinfo + +void rangeinfop4(){ + int i,j,k,l=0,num=addnum,clas[20]; + float grade[20]; + for(i=0;iclas[k+1]){ + swap(k,k+1); + } + } + } + while(clas[l]==clas[l+1]&&l='0'&&delnum[0]<='9'){ + for(i=0;i