From 17e84b640cd3969a7f5f009d6a1770b2321314c0 Mon Sep 17 00:00:00 2001 From: 556 <18408200125@stu.hut.edu.cn> Date: Wed, 9 Jan 2019 19:31:06 +0800 Subject: [PATCH] first commit --- Untitled1.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++ Untitled1.exe | Bin 106950 -> 106893 bytes 2 files changed, 123 insertions(+) create mode 100644 Untitled1.c diff --git a/Untitled1.c b/Untitled1.c new file mode 100644 index 0000000..b31b4d0 --- /dev/null +++ b/Untitled1.c @@ -0,0 +1,123 @@ +#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);printf("工号不存在:\n"); +printf("请输入工号:"); +scanf("%d",&number); +} +} +int main (){ + +int choice; +struct worker w[N]; +int NUM; +char stuName[100]; +int stuNum; +int length=0; +length=readFromFile(w);//读入 +do +{ xinxi(); +scanf("%d",&choice); +switch(choice) +{ case 1: +length=f(w,length); +break; +case 2: +input(w,length); +break; +} +}while(1); +} diff --git a/Untitled1.exe b/Untitled1.exe index 918c460ee542ae8f699b44cf4e908ccb5531352e..1547bc75af2a42596d4f4abd084de9cea12f8eb8 100644 GIT binary patch delta 4067 zcmZvfdu&rx9LLYEYrCyuve5y8b(vd5jA#Y|oieq`APqxkM8$zRkcUq8K$)gSp_^r} zGKSR|&y*NPobC_J6eV5>M5Z$WYJeFvzBgXU%x0W%nrYPfJ-ub;{;UU~H5i-EymKmuLSs_H~aec8KXz+kwv4_vS=h~_YUp_YwD@*PF_CSw!k%W+7`g0cCQP5gLUS4=`DUS zcx~HDt|{5kGOr!#YDEGdGp0|o*k_yP_bRn-Qd@^>vM17GxB8r&q@$l~%gMT`Y%fSF z>ahfF2m0|03P7fiinTmpGi{L{W$+m;O|Vi zS;_4d(*vod`+?Axrk;sS?szyGsc6dbLbPTbZ0O?u(aZmd$74fs zV{H6iq<@0ZKY=_~B1d9WhN@~qRXBCXo&ZgMy4b$*No47C2tlGi*hJ+<)9^ayIH{`L z{7AhJp7e22v$m=hW~CVy$TjsFLNGyCMTAJB&t>C$I!-ZJ?xP}lS=RYz9=&6{;-f3m zsMk1oJ-tD;&qy|uQlafE8J(qc*ybFC^GIf*G^61rddA_j*@QUdQlwCJFC>>ywul~0 zBad+?KrQ5$0l7gQ3D6~&ith$o1(04n<7xO4VySYUaG^{^)`JW%Qfus6Lhq9^1jU~% zgFeb%(v0(tY}3z-^b$xA{yO&SAh$E}4#>bo)@*$?;8LnsQYu`hvKCCnI z{^49Sfi&Pxm-@USP&9eX$X$V3;d~!T%$=C@>N7acfQh#H1w>tHk~qz?X3JMPvzddd z24=IuIC!VJ;Sbp5NG0VN+wLMi(G&7W1r>!Q%m*f0L%s$grdY`#5I-Y*%8QY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