您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 管理学资料 > 职工档案管理系统(c语言编写)
#includestdio.h#includestring.h#includestdlib.h#includeconio.h#includewindows.h#defineMAX_NUM45intmain(intargc,char*argv[]){structworker{intID;intAge;charSex[MAX_NUM];charName[MAX_NUM];charTelenum[MAX_NUM];intWage;intIncome;}work[MAX_NUM];voidshowmenu();intnumber,findID;inti,j,m,a,k,v,M,N,x,y;charb[MAX_NUM],c[MAX_NUM],n[MAX_NUM],filepn[MAX_NUM];FILE*fp;showmenu();scanf(%d,&k);for(;;){switch(k){case0:printf(\n您选择的是退出系统!\n);_beep(300,400);break;case1:printf(\n您选择的是档案录入!\n);printf(\n请输入本次录入的职工人数:);scanf(%d,&number);if(numberMAX_NUM){printf(您输入的人数太多,大于%d人!\n,MAX_NUM);break;}for(i=0;inumber;i++){printf(\n请输入第%d个职工的编号:\t,i+1);scanf(%d,&work[i].ID);printf(\t职工档案:\n);printf(\t\t姓名:);scanf(%s,&work[i].Name);printf(\t\t年龄:);scanf(%d,&work[i].Age);printf(\t\t手机号码:);scanf(%s,&work[i].Telenum);printf(\t\t性别:);scanf(%s,&work[i].Sex);printf(\t\t工资:);scanf(%d,&work[i].Wage);printf(\t\t奖金:);scanf(%d,&work[i].Income);}printf(\n您的输入是:\n);pintf(**********************************职工档案信息库*************************\n);printf(序号\t编号\t姓名\t年龄\t手机号码\t性别\t工资\t奖金\n);for(i=0;inumber;i++)printf(%d\t%d\t%s\t%d\t%s\t%s\t%d\t%d\n,i+1,work[i].ID,work[i].Name,work[i].Age,work[i].Telenum,work[i].Sex,work[i].Wage,work[i].Income);printf(*************************************************************************\n);printf(\n);break;case2:printf(\n您选择的是档案修改!\n);printf(\n请输入职工的编号:);scanf(%d,&findID);for(i=0;inumber;i++){if(work[i].ID==findID)break;}if(inumber){printf(\t姓名\t年龄\t手机号码\t性别\t工资\t奖金\n);printf(原档案:\n\t%s\t%d\t%s\t%s\t%d\t%d\n,work[i].Name,work[i].Age,work[i].Telenum,work[i].Sex,work[i].Wage,work[i].Income);printf(请输入新档案:\n);scanf(\t%s\t%d\t%s\t%s\t%d\t%d,&work[i].Name,&work[i].Age,&work[i].Telenum,&work[i].Sex,&work[i].Wage,&work[i].Income);}elseprintf(您输入的编号不存在!\n);break;case3:printf(\n您选择的是档案排序!\n);for(j=0;jnumber-1;j++)for(i=0;inumber-1;i++)if(work[i].IDwork[i+1].ID){m=work[i+1].ID;work[i+1].ID=work[i].ID;work[i].ID=m;strcpy(n,work[i+1].Telenum);strcpy(work[i+1].Telenum,work[i].Telenum);strcpy(work[i].Telenum,n);a=work[i+1].Age;work[i+1].Age=work[i].Age;work[i].Age=a;strcpy(b,work[i+1].Name);strcpy(work[i+1].Name,work[i].Name);strcpy(work[i].Name,b);strcpy(c,work[i+1].Sex);strcpy(work[i+1].Sex,work[i].Sex);strcpy(work[i].Sex,c);x=work[i+1].Wage;work[i+1].Wage=work[i].Wage;work[i].Wage=x;y=work[i+1].Income;work[i+1].Income=work[i].Income;work[i].Income=y;}printf(职工档案已排好序!\n);break;case4:printf(\n您选择的是档案删除!\n);printf(\n请输入职工的编号:);scanf(%d,&findID);for(i=0;inumber;i++){if(work[i].ID==findID)break;}printf(\t编号\t姓名\t年龄\t手机号码\t性别\t工资\t奖金\n);if(inumber){for(j=i;jnumber-1;j++){work[j].ID=work[j+1].ID;strcpy(work[j].Name,work[j+1].Name);strcpy(work[j].Telenum,work[j+1].Telenum);work[j].Age=work[j+1].Age;strcpy(work[j].Sex,work[j+1].Sex);work[j].Wage=work[j+1].Wage;work[j].Income=work[j+1].Income;}for(i=0;inumber-1;i++)printf(\t%d\t%s\t%d\t%s\t%s\t%d\t%d\n,work[i].ID,work[i].Name,work[i].Age,work[i].Telenum,work[i].Sex,work[i].Wage,work[i].Income);}elsefor(i=0;inumber-1;i++)printf(\t%d\t%s\t%d\t%s\t%s\t%d\t%d\n,work[i].ID,work[i].Name,work[i].Telenum,work[i].Age,work[i].Sex,work[i].Wage,work[i].Income);number--;break;case5:printf(\n您选择的是档案查询!\n);printf(*****************************请选择查询方式********************************\n);printf(\t\t1--查询个人;\t\t\t\t2--查询全部\n);/*以下可以修改为子菜单方式:1--查询个人,2--查询全部*/printf(***************************************************************************\n);printf(请选择:);scanf(%d,&v);switch(v){case1:printf(\n您选择的是个人查询!\n);printf(\n请输入职工的编号:);scanf(%d,&findID);for(i=0;inumber;i++){if(work[i].ID==findID)break;}if(inumber){printf(查找结果如下:\n);printf(\t编号\t姓名\t年龄\t手机号码\t性别\t工资\t奖金\n);printf(\t%d\t%s\t%d\t%s\t%s\t%d\t%d\n,work[i].ID,work[i].Name,work[i].Age,work[i].Telenum,work[i].Sex,work[i].Wage,work[i].Income);}elseprintf(您输入的编号不存在!\n);break;case2:printf(\n您选择的是全部查询!\n);printf(查找结果如下:\n);printf(\t编号\t姓名\t年龄\t手机号码\t性别\t工资\t奖金\n);for(i=0;inumber;i++)printf(\t%d\t%s\t%d\t%s\t%s\t%d\t%d\n,work[i].ID,work[i].Name,work[i].Age,work[i].Telenum,work[i].Sex,work[i].Wage,work[i].Income);break;}break;case6:printf(\n您选择的是职工档案的追加!\n);printf(\n您请输入需要追加的职工人数:\n);scanf(%d,&M);for(i=number;inumber+M;i++){printf(\n请输入第%d个职工的编号:\t,i+1);scanf(%d,&work[i].ID);printf(\t职工档案:\n);printf(\t\t姓名:);scanf(%s,&work[i].Name);printf(\t\t手机号码:);scanf(%s,&work[i].Telenum);printf(\t\t年龄:);scanf(%d,&work[i].A);printf(\t\t性别:);scanf(%s,&work[i].Sex);printf(\t\t工资:);scanf(%d,&work[i].Wage);printf(\t\t奖金:);scanf(%d,&work[i].Income);}number=number+M;break;case7:printf(\n您选择的是职工档案的插入!\n);printf(\n请输入被插入的职工的序号:(注意插在此序号之后));scanf(%d,&N);if(Nnumber){for(j=number;jN;j--){work[j].ID=work[j-1].ID;strcpy(work[j].Name,work[j-1].Name);strcpy(work[j].Telenum,work[j-1].Telenum);work[j].Age=work[j-1].Age;strcpy(work[j].Sex,work[j-1].Sex);work[j].Wage=work[j-1].Wage;work[j].Income=work[j-1].Income;}number=number+1;printf(\t职工档案:\n);printf(\n请输入%d这个职工的编号:,N+1);scanf(%d,&work[N].ID);printf(\t\t姓名:);scanf(%s,&work[N].Name);printf(\t\t手机号码:);scanf(%s,&work[N].Tele
本文标题:职工档案管理系统(c语言编写)
链接地址:https://www.777doc.com/doc-877346 .html