您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 人事档案/员工关系 > 高校教师人事管理系统C语言设计源代码
#includestdio.h#includestdlib.h#includestring.h#defineLENsizeof(structteacher)typedefstructdate{intyear;intmonth;intday;}SDATE;typedefstructteacher{longnum;charname[10];charsex[5];SDATEborn_time;SDATEwork_time;longsalary;characademy[10];charpost[10];chardegree[10];}TE;voidcreat();//初始化老师信息voidadd();//对文件进行增加信息voiddel();//删除信息voidmodify();//修改信息voidsearch();//对信息进行查询voidstatis();//对信息进行统计voidsort();//排序voidsaveTeachers();//保存老师信息voidsearchName();//按姓名查询voidsearchNum();//按编号查询voidsearchAcd();//按学院查询voidsearchPost();//按职称查询voidsearchWtime();//按工作时间查询voidoutputTeacher(int);//输出指定教师信息voidstatis1980();voidstatisPost();voidstatisDe();voidstatisSa();TETeacher[100];inttn;//老师数量//主函数voidmain(){intm;while(1){printf(\n**********高校教师人事管理系统**********\n);printf(\n**创建信息文件,请按1**);printf(\n**追加教师信息,请按2**);printf(\n**删除教师信息,请按3**);printf(\n**修改教师信息,请按4**);printf(\n**查询教师信息,请按5**);printf(\n**统计教师信息,请按6**);printf(\n**退出系统,请按0**\n);scanf(%d,&m);getchar();switch(m){case1:creat();break;case2:add();break;case3:del();break;case4:modify();break;case5:search();break;case6:statis();break;case0:exit(0);break;default:printf(按键错误,请重新输入!\n);}//endswitch}//endwhile}//建立链表,排序,写入文件voidcreat(void){intflag=1;while(flag){printf(\n请输入编号\n);scanf(%ld,&Teacher[tn].num);printf(\n请输入姓名\n);scanf(%s,Teacher[tn].name);printf(\n请输入性别\n);scanf(%s,&Teacher[tn].sex);printf(\n请输入出生日期\n);scanf(%d%d%d,&Teacher[tn].born_time.year,&Teacher[tn].born_time.month,&Teacher[tn].born_time.day);printf(\n请输入参加工作时间\n);scanf(%d%d%d,&Teacher[tn].work_time.year,&Teacher[tn].work_time.month,&Teacher[tn].work_time.day);printf(\n请输入工资\n);scanf(%d,&Teacher[tn].salary);printf(\n请输入学院\n);scanf(%s,Teacher[tn].academy);printf(\n请输入职称(助教、讲师、副教授、教授)\n);scanf(%s,Teacher[tn].post);printf(\n请输入学位(学士、硕士、博士)\n);scanf(%s,Teacher[tn].degree);tn++;printf(继续输入?yes1no0\n);scanf(%d,&flag);getchar();}sort();saveTeachers();}//===================================排序==============================voidsort(){inti,j,k;TEtemp;for(i=0;itn-1;i++){k=i;for(j=i+1;jtn;j++)if(Teacher[k].numTeacher[j].num)k=j;if(k!=i){temp=Teacher[i];Teacher[i]=Teacher[k];Teacher[k]=temp;}}//endfor}//=======================保存老师信息===================================voidsaveTeachers(){FILE*fp;fp=fopen(teacher.dat,wb+);if(!fp){printf(filecan'topen!\n);return;}if(fwrite(Teacher,LEN,tn,fp)==tn)printf(老师信息保存成功!\n);}//========================================================================//输出voidoutputTeacher(inti){printf(编号为%ld\n,Teacher[i].num);printf(姓名为%s\n,Teacher[i].name);printf(性别为%s\n,Teacher[i].sex);printf(出生日期为%4d.%2d.%2d\n,Teacher[i].born_time.year,Teacher[i].born_time.month,Teacher[i].born_time.day);printf(参加工作时间为%4d.%2d.%2d\n,Teacher[i].work_time.year,Teacher[i].work_time.month,Teacher[i].work_time.day);printf(工资为%d\n,Teacher[i].salary);printf(学院为%s\n,Teacher[i].academy);printf(职称为%s\n,Teacher[i].post);printf(学位为%s\n,Teacher[i].degree);}//=====================添加================voidadd(){creat();}voiddel(){longnum;intflag=1,f;inti,j;while(flag){printf(编号:\n);scanf(%ld,&num);for(i=0;itn;i++){if(num==Teacher[i].num)break;}//endforif(i=tn)printf(编号输入错误!\n);else{outputTeacher(i);//显示删除的教师信息printf(确认删除?yes1no0\n);scanf(%d,&f);if(f==1){for(j=i;jtn-1;j++)Teacher[j]=Teacher[j+1];tn--;}//endif}//endelseprintf(继续删除其他教师?yes1no0\n);scanf(%d,&flag);}//endwhilesort();saveTeachers();}//==============================================================voidmodify(){inti,num,select;intflag=1,f=1;while(flag){printf(请输入修改教师的编号!\n);scanf(%ld,&num);for(i=0;itn;i++){if(num==Teacher[i].num)break;}//endforif(i=tn)printf(编号输入错误!\n);else{while(f){printf(1.修改编号\n);printf(2.修改姓名\n);printf(3.修改性别\n);printf(4.修改出生日期\n);printf(5.修改参加工作时间\n);printf(6.修改工资\n);printf(7.修改学院\n);printf(8.修改职称\n);printf(9.修改学位\n);scanf(%d,&select);getchar();switch(select){case1:printf(新编号:\n);scanf(%ld,&Teacher[i].num);f=0;break;case2:printf(新姓名:\n);scanf(%s,Teacher[i].name);f=0;break;case3:printf(新性别:\n);scanf(%s,Teacher[i].sex);f=0;break;case4:printf(新出生日期:\n);scanf(%d%d%d,&Teacher[tn].born_time.year,&Teacher[tn].born_time.month,&Teacher[tn].born_time.day);f=0;break;case5:printf(新工作时间:\n);scanf(%d%d%d,&Teacher[tn].work_time.year,&Teacher[tn].work_time.month,&Teacher[tn].work_time.day);f=0;break;case6:printf(新工资:\n);scanf(%d,&Teacher[i].salary);f=0;break;case7:printf(新学院:\n);scanf(%s,Teacher[i].academy);f=0;break;case8:printf(新职称:\n);scanf(%s,Teacher[i].post);f=0;break;case9:printf(新学位:\n);scanf(%s,Teacher[i].degree);f=0;break;default:printf(按键错误,重新输入\n);}//endswitch}//endwhile}//endelse}//endwhilesort();saveTeachers();}//voidsearch(){inti,j;intflag=1,f=1;longnum;while(flag){printf(\n按编号查询请输入1\n);printf(\n按精确姓名查询请输入2\n);printf(\n按学院查询请输入3\n);printf(\n按职称查询请输入4\n);printf(\n按参加工作时间查询请输入5\n);printf(\n退出查询输入0\n);scanf(%d,&i);getchar();switch(i){case1:searchNum();break;case2:searchName();break;case3:searchAcd();break;case4:searchPost();break;case5:searchWtime();break;case0:return;default:printf(按键错误,请重新输入!\n);f=0;}//endswitchif(f){printf(继续查询?yes1no0\n);scanf(%d,&flag);ge
本文标题:高校教师人事管理系统C语言设计源代码
链接地址:https://www.777doc.com/doc-2402176 .html