人事管理系统代码文档格式.docx
《人事管理系统代码文档格式.docx》由会员分享,可在线阅读,更多相关《人事管理系统代码文档格式.docx(14页珍藏版)》请在冰豆网上搜索。
voidmenu();
voidprintf_face()/*显示数据结构项目函数*/
printf("
numnamesexagedutytitilelandscapequilificationservicetimecometimecategory\n"
);
}
voidprintf_one(structstaffp)/*输出单个数据函数*/
%-4s%-7s%-6s%-3d%-11s%-7s%-8s%-18s%-7d%-12s%-3s\n"
p.num,p.name,p.sex,p.age,p.duty,p.title,p.p_landscape,p.Qualifications,p.Service_time,e_time,p.category);
intload()/*加载函数*/
inti=0;
FILE*fp;
if((fp=fopen("
text.txt"
"
rb"
))==NULL){
return0;
exit(0);
for(i=0;
!
feof(fp);
i++){/*输出数据到结构体*/
fscanf(fp,"
%s%s%s%d%s%s%s%s%d%s%s\n"
staff[i].num,staff[i].name,staff[i].sex,&
staff[i].age,staff[i].duty,staff[i].title,staff[i].p_landscape,staff[i].Qualifications,&
staff[i].Service_time,staff[i].come_time,staff[i].category);
fclose(fp);
returni;
intsearch_data()/*查找单个数据函数*/
inti,flag;
chars[30],w0;
system("
cls"
/*清屏*/
n=load();
do{
fflush(stdin);
/*清除缓冲区输入*/
By1)Number2)Name[]\b\b"
w0=getchar();
}while(w0<
'
1'
||w0>
2'
if(w0=='
){/*按编号查找*/
flag=0;
puts("
Enterstaff'
snumber:
"
scanf("
%s"
s);
i<
n;
i++){
if(strcmp(s,staff[i].num)==0){
printf_face();
printf_one(staff[i]);
flag=1;
break;
elsecontinue;
if(flag==0)puts("
Thestaff'
snamedosenotexsist!
else{/*按姓名查找*/
Enterstaffname:
if(strcmp(s,staff[i].name)==0){
if(flag==0)puts("
smessagedosenotexsist!
voidsave_all()/*保存所有数据函数*/
inti;
wb"
Cannotopenfile!
exit(0);
}
if(staff[i].age!
=0)
fprintf(fp,"
staff[i].num,staff[i].name,staff[i].sex,staff[i].age,staff[i].duty,staff[i].title,staff[i].p_landscape,staff[i].Qualifications,staff[i].Service_time,staff[i].come_time,staff[i].category);
inttest(charh[10])/*检查编号是否重复*/
i++)
if(strcmp(h,staff[i].num)==0){
Thenumberhasexsist!
pleasenteragain!
pause"
return1;
voidsave(structstaffp)/*保存单个数据函数*/
ab+"
Cannotopenfile!
Succesefultosavemessage!
\n"
/*********************************修改模块**********************************/
voidmodify()
intk=0,w0,g;
charh[30],w1,w2;
loop:
g=search_data();
if(g<
n){
\t\t\tModify:
1)Numder"
\t\t\t2)Name"
\t\t\t3)Sex"
\t\t\t4)Age"
\t\t\t5)Duty"
\t\t\t6)Title"
\t\t\t7)Landscape"
\t\t\t8)Qualifications"
\t\t\t9)Servicetime"
\t\t\t10)Cometime"
\t\t\t11)Category"
Pleasechoice:
[]\b\b"
%d"
&
w0);
}while(w0<
1||w0>
11);
switch(w0)
{case1:
EnterNewNumber:
h);
strcpy(staff[g].num,h);
case2:
Entername:
strcpy(staff[g].name,h);
case3:
Entersex:
strcpy(staff[g].sex,h);
case4:
Enterage:
k);
staff[g].age=k;
case5:
Enterduty:
strcpy(staff[g].duty,h);
case6:
Entertitile:
strcpy(staff[g].title,h);
case7:
Enterlandscape:
strcpy(staff[g].p_landscape,h);
case8:
Enterqualiications:
strcpy(staff[g].Qualifications,h);
case9:
Enterservicetime:
staff[g].Service_time=k;
case10:
Entercometime:
strcpy(staff[g].come_time,h);
case11:
Entercategory:
strcpy(staff[g].category,h);
Areyousuretosave?
1)Yes2)No[]\b\b"
w1=getchar();
}while(w1<
||w1>
if(w1=='
){save_all();
puts("
Succesefulltosave!
1)Continuetomodify2)Backtomenu3)Exist[]\b\b"
w2=getchar();
}while(w2<
||w2>
3'
if(w2=='
)gotoloop;
elseif(w2=='
)menu();
elseexit(0);
/************************保存模块******************************/
voidzhun()
charw0;
save_all();
Havesaveallmessage!
1)Backtomenu2)Exist[]\b\b"
/*************************查找模块*****************************/
voidsearch()
intk;
charw1;
k=search_data();
1)Backtomenu2)Exist3)Continuetosearch[]\b\b"
elseif(w1=='
)exit(0);
elsegotoloop;
/***************************增加模块*****************************/
voidadd()
charw0,w1;
system("
munder(exmple001):
s.num);
if(test(s.num))gotoloop;
/*编号重复*/
name:
s.name);
sex(male,female):
s.sex);
age:
s.age);
duty(jiaochoufujiaochoujiangshizhujiaoxueshenghoujin):
s.duty);
title(NOlowhight):
s.title);
landscape(partynot):
s.p_landscape);
hightestqualifications(xiaoxuezhuzhonggaozhongdaxueshuoshigengao):
s.Qualifications);
servetime:
s.Service_time);
cometime(example20050101):
e_time);
category(massengerteacherstaffenteirlinshigong):
s.category);
Saveornot?
1)Yes2)No[]\b\b"
switch(w0-48)
case1:
save(s);
1)Coninnuetoadd2)Backtomenu3)Exist[]\b\b"
/*******************************删除模块*****************************/
voiddelete_data()
charw0,w1;
if(k<
Areyousuretodelete?
1)Yes2)No[]\b\b"
){
staff[k].age=0;
Thisstaffmassegehasdeleteed!
1)Continuetodelete2)Backtomenu3)Exisi[]\b\b"
)gotoloop;
/********************************统计模块*******************************/
voidstastic()
inti,count;
if(n==0){
Nodata!
getchar();
menu();
By1)Staffonwork2)partymember\n"
3)femalecount4)Highestqualifications[]\b\b"
4'
){/*统计在职人员*/
for(i=0,count=0;
n&
&
staff[i].age;
if(strcmp(staff[i].category,"
enteir"
)!
=0&
strcmp(staff[i].category,"
linshigong"
=0){
count++;
printf_one(staff[i]);
\t\t\t\tTotal%dmessages"
count);
elseif(w0=='
){/*统计党员*/
if(strcmp(staff[i].p_landscape,"
party"
)==0){
){/*统计女工人员*/
if(strcmp(staff[i].sex,"
femal"
\t\t\t\tTotal%dmessage"
else{/*统计高学历人员*/
if(strcmp(staff[i].Qualifications,"
shuoshi"
)==0||strcmp(staff[i].Qualifications,"
更高"
\n1)Continuetostastic2)Backtomenu3)Exist[]\b\b"
/*******************************排序模块***********************************/
voidsort()
inti,j;
structstaffs1;
n=load();
By1)age2)Cometime[]\b\b"
){/*按年龄排序*/
n-1;
i++)/*选择法排序*/
for(j=i+1;
j<
j++)
if(staff[i].age>
staff[j].age){
s1=staff[i];
staff[i]=staff[j];
staff[j]=s1;
else{/*按来院时间排序*/
if(strcmp(staff[i].come_time,staff[j].come_time)>
0){
i++)/*显示排序结果*/
\n1)Backtomenu2)Continue3)Exist[]\b\b"
)menu();
/********************************浏览模块**************************************/
voidbrowse()
n;
\t\t\t\tTatal(%d)message\n"
n);
1)Backtom