欢迎来到天天文库
浏览记录
ID:41554198
大小:51.04 KB
页数:8页
时间:2019-08-27
《职工信息管理系统2》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、#include#include#include#include#defineN1000voidoutput();voidinit();voidread1();voidnewfile();voidweihu();voidnew1();intfind(charenof]);intfindname(charename[]);voidsave();voidcultureorder();voiddeletel();voidmodifyO;voidfindl();struct
2、employee{charnoflOl;charname[20];charsex[4];intage;charposition[20J;intculture;structdate{intmonth;intday;intyear;}birthday;chartele[15];intsalary;charadress[10];}em[NJ;intnum;voidinit(){if(access("emp.txt",,'O"))newfile();elseread1();voidoutput(){inti;联系方法print"工号姓名性别年龄
3、职位学历出生日期薪水地址M);for(i=0;i4、m[i].adress,em[i].tele);voidread1(){FILE*fp;num=0;fp=fopen(',emp.txt'"r");if(fp==NULL){printf(n文件打开失败!请重新运行!!!”);exit(O);1while(!feof(fp)){fread(&em[num],1,sizeof(structemployee),fp);num++;}num・・;fclose(fp);printf(n现在共有%d个数据,初始数据为:“);output();}voidnewfile(){inti;FIL5、E*fp;if((fp=fopen(Hemp.txt",uwb"))==NULL)printf("文件创建失败!请重新运行。”);exit(O);printfC请输入职工人数:”);scanf("%d",&num);for(i=0;i6、,&em[i].age);printf("职位:”);scanf("%s",em[i].position);printfC学历(1.博士后,2.博士,3.硕士,4.学士):”);scanf(”%d",&em[i].culture);printf(n出生H期:(月FI年请以空格隔开门;scanf(M%d%d%d",&em[i].birthday.month,&em[i].birthday.day,&em[i].birthday.year);printfC薪水scanf("%d'&em[i].salary);printf(M地址:”);s7、canf("%sH,em[i].adress);printf("联系方法:”);scanf("%s",em[i].tele);fwrite(&emlij,sizeof(structemployee),1,fp);}fclose(fp);printfCf你刚才输入的数据共有%4个职工信息。详细数据是:”,num);output();voidweihu(){intchoice1;printf("printf("printf(nprintf("************职丁信,息、幺乍护子菜单.************咅*咅*咅*咅*咅**8、、□")•************]新增**************5“)・************2•删除(按工号)***********枠*『);$$$$$$$”);printfC谓选择:“);s
4、m[i].adress,em[i].tele);voidread1(){FILE*fp;num=0;fp=fopen(',emp.txt'"r");if(fp==NULL){printf(n文件打开失败!请重新运行!!!”);exit(O);1while(!feof(fp)){fread(&em[num],1,sizeof(structemployee),fp);num++;}num・・;fclose(fp);printf(n现在共有%d个数据,初始数据为:“);output();}voidnewfile(){inti;FIL
5、E*fp;if((fp=fopen(Hemp.txt",uwb"))==NULL)printf("文件创建失败!请重新运行。”);exit(O);printfC请输入职工人数:”);scanf("%d",&num);for(i=0;i6、,&em[i].age);printf("职位:”);scanf("%s",em[i].position);printfC学历(1.博士后,2.博士,3.硕士,4.学士):”);scanf(”%d",&em[i].culture);printf(n出生H期:(月FI年请以空格隔开门;scanf(M%d%d%d",&em[i].birthday.month,&em[i].birthday.day,&em[i].birthday.year);printfC薪水scanf("%d'&em[i].salary);printf(M地址:”);s7、canf("%sH,em[i].adress);printf("联系方法:”);scanf("%s",em[i].tele);fwrite(&emlij,sizeof(structemployee),1,fp);}fclose(fp);printfCf你刚才输入的数据共有%4个职工信息。详细数据是:”,num);output();voidweihu(){intchoice1;printf("printf("printf(nprintf("************职丁信,息、幺乍护子菜单.************咅*咅*咅*咅*咅**8、、□")•************]新增**************5“)・************2•删除(按工号)***********枠*『);$$$$$$$”);printfC谓选择:“);s
6、,&em[i].age);printf("职位:”);scanf("%s",em[i].position);printfC学历(1.博士后,2.博士,3.硕士,4.学士):”);scanf(”%d",&em[i].culture);printf(n出生H期:(月FI年请以空格隔开门;scanf(M%d%d%d",&em[i].birthday.month,&em[i].birthday.day,&em[i].birthday.year);printfC薪水scanf("%d'&em[i].salary);printf(M地址:”);s
7、canf("%sH,em[i].adress);printf("联系方法:”);scanf("%s",em[i].tele);fwrite(&emlij,sizeof(structemployee),1,fp);}fclose(fp);printfCf你刚才输入的数据共有%4个职工信息。详细数据是:”,num);output();voidweihu(){intchoice1;printf("printf("printf(nprintf("************职丁信,息、幺乍护子菜单.************咅*咅*咅*咅*咅**
8、、□")•************]新增**************5“)・************2•删除(按工号)***********枠*『);$$$$$$$”);printfC谓选择:“);s
此文档下载收益归作者所有