c语言课程设计 职工信息管理系统

上传人:s****a 文档编号:118848242 上传时间:2022-07-12 格式:DOCX 页数:8 大小:11.08KB
返回 下载 相关 举报
c语言课程设计 职工信息管理系统_第1页
第1页 / 共8页
c语言课程设计 职工信息管理系统_第2页
第2页 / 共8页
c语言课程设计 职工信息管理系统_第3页
第3页 / 共8页
亲,该文档总共8页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
C语言课程设计1. 设计题目:职工信息管理系统2. 系统功能简介:系统以菜单方式工作1)职工信息录入(文件保存职工信息)2)输出职工信息、浏览职工信息3)查询职工信息4)根据员工号查找职工信息5)根据工资、年龄、性别对职工信息进行排序6)删除职工信息3. 设计实施:#include #include #include typedef struct Empk int EmpNum;/* staff number */char EmpName12;/* name*/int Sex;/*sex 1- woman 2- man*/int Old;/* old*/int Cult;/*education background 1-specilist 2-doctor 3-others*/int Salary;/*salary*/char Address12;/* address*/int Tell;/*telephone number*/Emp;Emp emp100;void open()int i;FILE *fp;if(fp=fopen(wyl,rb+)=NULL)printf(can not do it! Because of no file of information、/);exit(0);for(i=0;i100;i+)if(fread(&empi,sizeof(Emp),1,fp)=0)printf(Fail to outputn);exit(0);fclose(fp);void close()/* 跳出 */int i;FILE *fp;if(fp=fopen(wyl,wr+)=NULL)printf(can not do it!n);exit(0);for(i=0;i100;i+)fwrite(&empi,sizeof(Emp),1,fp);fclose(fp);void inputEmpInfo()/*输入信息 */int i,k;for(i=0;i100;i+)printf(Please enter the staffs :nnumber:);scanf(d,&empi.EmpNum);printf(nname:);scanf(s,empi.EmpName);printf(nsex : 1- woman 2- man:);scanf(d,&empi.Sex);printf(nold:);scanf(%d,&empi.Old);printf(nEducation background:1-specialist 2-doctor 3-others);scanf(d,&empi.Cult);printf(nsalary:);scanf(d,&empi.Salary);printf(naddress:);scanf(%s,empi.Address);printf(ntellphone:);scanf(%d,&empi.Tell);printf(continue?(1.yes 2.no); scanf(%d,&k); if(k=2) break; close();void reorder()/* 修改 */int i,s,j,k,l;Emp temp;open();printf(nChoose which category would you want to usen1sex n2salary(frommaximum to minimum) n3old (from maximum to minimum) n( enter thecorresponding nember) n); scanf(%d,&i);switch(i)case 1:printf(nchoose which sex do you want to inquire? 1woman 2 man ); scanf(%d,&s);for(j=0;empj.EmpNum!=0;j+)if(empj.Sex=s)printf( number:%dn,empj.EmpNum);printf(name:%s, empj.EmpName);printf(nsex 1- woman 2- man:%d, empj.Sex);printf(nold:%d, empj.Old);printf(neducation background:%dttt 1-specialist 2-doctor 3-others ,empj.Cult);printf(nsalary:%d, empj.Salary);printf(naddress:%s, empj.Address);printf(ntelephone nember :%d, empj.Tell);break;case 2:for(k=0;empk.EmpNum!=0;j+ )for(l=k;empl.EmpNum!=0;l+)if(empl.Salaryempl+1.Salary)temp=empl;empl=empl+1;empl+1=temp;printf( number:%dn,empk.EmpNum);printf(name:%s,empk.EmpName);printf(nsex 1- woman 2- man:%d,empk.Sex);printf(nold:%d,empk.Old);printf(neducation background:%dttt 1-specialist 2-doctor ,empk.Cult);printf(nsalary:%d,empk.Salary);printf(nadress:%s,empk.Address);printf(ntelephone nember :%d,empk.Tell);break;case 3:for(k=0;empk.EmpNum!=0;j+ )for(l=k;empl.EmpNum!=0;l+)if(empl.Oldempl+1.Old)temp=empl;empl=empl+1;empl+1=temp;printf( number:%dn,empk.EmpNum);printf(name:%s,empk.EmpName);printf(nsex 1- woman 2- man:%d,empk.Sex);printf(nold:%d,empk.Old);printf(neducation background:%dttt1-specialist3-others,empk.Cult);printf(nsalary:%d,empk.Salary);printf(naddress:%s,empk.Address);printf(ntelephone nember :%d,empk.Tell);break;void show()int j;open();printf(ninformations3-others2-doctorofsraffsn);for(j=0;empj.EmpNum!=0;j+)printf(number:%dn,empj.EmpNum);printf(name:%s,empj.EmpName);printf(nsex 1- woman 2- man:%d,empj.Sex);printf(nold:%d,empj.Old);printf(neducation background:%d1-specialist 2-doctor 3-others,empj.Cult);printf(nsalary:%d,empj.Salary);printf(nadress:%s,empj.Address);printf(ntelephone nember :%d,empj.Tell);void deleteEmp()int j,k,m=1,d,i=0;open();printf(Enter the number whose date you want to delete:n);scanf(d,&d);for(j=0;empj.EmpNum!=0;j+)if(empj.EmpNum=d)for(k=j;empj.EmpNum!=0;k+)empk=empk+1;i+;if(i=0)printf(The staffs informations manage systerm has no date of the number your entered!n);close();printf(succeeed to deleten);void findByEmpName() /* 查询 */ int j,i,k=0;open();printf(Please enter the number :n); scanf(d,&i);for(j=0;empj.EmpNum!=0;j+)if(empj.EmpNum=i)printf(ninformation of your wantn);printf(number:%dn,empj.EmpNum);printf(name:%s,empj.EmpName);printf(nsex 1- woman 2- man:%d,empj.Sex);printf(nold:%d,empj.Old);printf(neducation background:%dtttt 1-specialist 2-doctor 3-others ,empj.Cult);printf(nsalary:%d,empj.Salary);printf(nadress:%s,empj.Address);printf(ntelephone number:%d,empj.Tell);k+;if(k=0)printf(nHave no date of the number!n);void menu()printf(nn);printf(nWellcome to the staff manage stytermn);printf(nn);printf(Please choose number for what are you want to do:nn);printf(n1 input: Complete inputing workers information.);printf(n2 reorder: Make the new order of the information.);printf(n3 delete: Deletethe information of the staff.);printf(n4 output: Display all worker of information.);printf(n5inquire.);printf(n0 exitn);void main()int op,choice=1;while(choice=1)menu();printf(nPlease enter your order:n);scanf(%d,&op);switch(op)case 1: inputEmpInfo();break;case 2: reorder();break;case 3: deleteEmp();break;case 4: show();break;case 5: findByEmpName();break;case 0: printf(Welcome to use worker management system, goodbye!);exit(0);getchar();printf(nn);printf(nWhether continue? Yes-1 No2n);scanf(%d”,choice);
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 活动策划


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!