资源描述:
《C语言企业员工管理系统.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、C语言——企业员工管理系统代码部分:#include#include#includetypedefstructemployee{intnum;charduty[10];charname[10];charsex[3];unsignedcharage;charedu[10];intsalary;chartel_office[13];chartel_home[13];charmobile[13];charqq[11];charaddress[31];structemp
2、loyee*next;}EMP;charpassword[9];EMP*emp_first,*emp_end;chargsave,gfirst;voidaddemp(void);voidfindemp(void);voidlistemp(void);voidmodifyemp(void);voidsummaryemp(void);voiddelemp(void);voidresetpwd(void);voidreaddata(void);voidsavedata(void);intmodi_age(ints);intm
3、odi_salary(ints);char*modi_field(char*field,char*s,intn);EMP*findname(char*name);EMP*findnum(intnum);EMP*findtelephone(char*name);EMP*findqq(char*name);voiddisplayemp(EMP*emp,char*field,char*name);voidcheckfirst(void);voidbound(charch,intn);voidlogin();voidmenu(
4、);voidaddemp(){FILE*fp;EMP*emp1;inti=0;charchoice='y';if((fp=fopen("employee.dat","ab"))==NULL){printf("打开文件employee.dat出错!");getch();return;}do{i++;emp1=(EMP*)malloc(sizeof(EMP));if(emp1==NULL){printf("存分配失败,按任意键退出!");getch();return;}printf("请输入第%d个员工的信息,
5、",i);bound('_',30);printf("工号:");scanf("%d",&emp1->num);printf("职务:");scanf("%s",&emp1->duty);printf(":");scanf("%s",&emp1->name);printf("性别:");scanf("%s",&emp1->sex);printf("年龄:");scanf("%d",&emp1->age);printf("文化程度:");scanf("%s",&emp1->edu);printf("工资:");scanf
6、("%d",&emp1->salary);printf("办公:");scanf("%s",&emp1->tel_office);printf("家庭:");scanf("%s",&emp1->tel_home);printf("移动:");scanf("%s",&emp1->mobile);printf("QQ:");scanf("%s",&emp1->qq);printf("地址:");scanf("%s",&emp1->address);emp1->next=NULL;if(emp_first==NULL){em
7、p_first=emp1;emp_end=emp1;}else{emp_end->next=emp1;emp_end=emp1;}fwrite(emp_end,sizeof(EMP),1,fp);gfirst=0;printf("");bound('_',30);printf("是否继续输入?(y/n)");fflush(stdin);choice=getch();if(toupper(choice)!='Y'){fclose(fp);printf("输入完毕,按任意键返回");getch();retu
8、rn;}system("cls");}while(1);}voidbound(charch,intn){while(n--)putch(ch);printf("");return;}/*首次使用,进行用户信息初始化*/voidcheckfirst(){FILE*fp,*fp1;charpwd[9],pwd1[9],pwd2[9