diff --git a/Untitled1.exe b/Untitled1.exe index 1547bc7..2de3c66 100644 Binary files a/Untitled1.exe and b/Untitled1.exe differ diff --git a/工作量统计.c b/工作量统计.c new file mode 100644 index 0000000..ca44c44 --- /dev/null +++ b/工作量统计.c @@ -0,0 +1,243 @@ +#include "stdio.h" +#include "stdlib.h" +#define FILENAME "worker.bin" +#define N 20 +/******************************************************* + +*******************************************************/ +struct worker +{ +int number; /**/ +int counts; /**/ +int grade; /**/ +}; +/******************************************************* +ʾ˵ +*******************************************************/ +void xinxi() +{ +printf("\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); +printf("+ ְͳϵͳ +\n"); +printf("+ +\n"); +printf("+ 1. ְϢ +\n"); +printf("+ +\n"); +printf("+ 2. +\n"); +printf("+ +\n"); +printf("+ 3. +\n"); +printf("+ +\n"); +printf("+ 4. ְŽϢɾ +\n"); +printf("+ +\n"); +printf("+ 5. +\n"); +printf("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); +} +/******************************************************* +ϢʾĻ +*******************************************************/ +readFromFile(struct worker w[]) +{ +FILE *fp=NULL; +int i=0; +fp=fopen(FILENAME,"rb"); /*ļ*/ +if(fp!=NULL) +{ +while(!feof(fp)) /*ļжѧ*/{ +if(i>=N) +break; +if(fread(w+i,sizeof(w),1,fp)==1) +i++; +} +fclose(fp); +} +return i; +} +/******************************************************* +:ְϢ +*******************************************************/ +int f(struct worker w[],int length) +{ +int i=length; +while(i=length) +printf("Ų:\n"); +printf("빤:"); +scanf("%d",&number); +} +} +//////////////////////////////////////////////////////////////////////////////// +/* С򲢱 *///////////////////////////////////////////////////////////////////////////////// +void sortCounts(struct worker w[],int length) +{ +int i=0,j=0,k=0; +struct worker s; +for(i=0;i0) +w[0].grade =1; +for(i=1;i0) +{ while(i