人事管理系统doc.docx

上传人:b****1 文档编号:2395113 上传时间:2022-10-29 格式:DOCX 页数:22 大小:227.90KB
下载 相关 举报
人事管理系统doc.docx_第1页
第1页 / 共22页
人事管理系统doc.docx_第2页
第2页 / 共22页
人事管理系统doc.docx_第3页
第3页 / 共22页
人事管理系统doc.docx_第4页
第4页 / 共22页
人事管理系统doc.docx_第5页
第5页 / 共22页
点击查看更多>>
下载资源
资源描述

人事管理系统doc.docx

《人事管理系统doc.docx》由会员分享,可在线阅读,更多相关《人事管理系统doc.docx(22页珍藏版)》请在冰豆网上搜索。

人事管理系统doc.docx

人事管理系统doc

人事管理系统

一:

题目要求

某高校主要人员有:

在职人员(行政人员,教师,一般员工),退休人员和临时工。

现在需要存储这些人员的人事档案信息,内容包括编号,姓名,性别,年龄,职务,职称,政治面貌,最高学历任职时间,来院时间,人员类别,其中,人员编号唯一,不能重复。

(1)添加删除功能:

能根据来院人事的变动情况,添加删除记录

(2)查询功能:

能根据编号和姓名进行查询。

(3)编辑功能:

根据查询对相应的记录进行修改并存储。

(4)统计功能:

能根据多种叁数进行人员的统计(在职人数,党员人数,女工人数,高学历职称人数(硕士学位以上或副教授以上)),统计要求同时显示被统计者的信息。

(5)排序功能:

按照年龄,来院时间进行排序。

(6)保存功能:

能对输入的数据进行存储。

二:

需求分析

根据题目要求,程序需要根据人员的流动,添加或删除人员的信息,拟定做一个添加功能,同时保存人员的信息,在程序中需要浏览,搜索人员信息,应提供显示,查找,排序等功能,同时还要删除修改人员的信息。

三)总体设计

程序可分为九个小模块,分别为:

1)增加人员信息;2删除人员信息

3)查询人员信息4)修改人员信息5)统计人员信息6)对人员排序

7)保存人员信息8)浏览人员信息;9)退出

四:

详细设计

(1)结构体

#include

#include

#include

structstaff/*定义结构体*/

{

charnum[10];/*编号*/

charname[20];/*姓名*/

charsex[10];/*性别*/

intage;/*年龄*/

charduty[20];/*职务*/

chartitle[20];/*职称*/

charp_landscape[30];/*政治面貌*/

charQualifications[30];/*学历*/

intService_time;/*任职时间*/

charcome_time[30];/*来院时间*/

charcategory[30];/*人员类别*/

}staff[100];

structstaffs;

intn;

voidmenu();

(2)printf_face函数主要显示结构体中各种信息的位置,便于识别信息

voidprintf_face()/*显示数据结构项目函数*/

{

printf("numnamesexagedutytitilelandscapequilificationservicetimecometimecategory\n");

}

(3)printf_one(structstaffp)与pint_face()连用,能很好的显示人员的

各种信息

voidprintf_one(structstaffp)/*输出单个数据函数*/

{

printf("%-10s%-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);

}

(4)loan()函数主要是打开一个文件同时将文件中的内容输出,同时返回文件中的数据个数,即有几个人员的信息

 

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;

}

(5)查找函数主要通过编号和姓名两种方式进行查找,并通过flag是否为零来判断输入的数据是否存在。

intsearch_data()/*查找单个数据函数*/

{

inti,flag;

chars[30],w0;

system("cls");/*清屏*/

n=load();

do{

fflush(stdin);/*清除缓冲区输入*/

printf("By1)Number2)Name[]\b\b");

w0=getchar();}while(w0<'1'||w0>'2');

if(w0=='1'){/*按编号查找*/

flag=0;

puts("Enterstaff'snumber:

");

scanf("%s",s);

for(i=0;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{/*按姓名查找*/

flag=0;

puts("Enterstaffname:

");

scanf("%s",s);

for(i=0;i

if(strcmp(s,staff[i].name)==0){

printf_face();

printf_one(staff[i]);

flag=1;break;}

elsecontinue;

}

if(flag==0)puts("Thestaff'smessagedosenotexsist!

");

}

returni;

}

(6)保存函数建立一个text.txt文件并读入输入的数据通过年龄是否为零来判断是否存入数据。

voidsave_all()/*保存所有数据函数*/

{

inti;

FILE*fp;

if((fp=fopen("text.txt","wb"))==NULL){

printf("Cannotopenfile!

");exit(0);}

for(i=0;i

if(staff[i].age!

=0)

fprintf(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);

elsecontinue;}

fclose(fp);

}

inttest(charh[10])/*检查编号是否重复*/

{

inti;

n=load();

for(i=0;i

if(strcmp(h,staff[i].num)==0){

puts("Thenumberhasexsist!

pleasenteragain!

");system("pause");

return1;}

return0;

}

voidsave(structstaffp)/*保存单个数据函数*/

{

FILE*fp;

if((fp=fopen("text.txt","ab+"))==NULL){

printf("Cannotopenfile!

");exit(0);}

fprintf(fp,"%s%s%s%d%s%s%s%s%d%s%s\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);

printf("Succesefultosavemessage!

\n");

fclose(fp);

}

/*********************************修改模块**********************************/

voidmodify()

{

intk=0,w0,g;

charh[30],w1,w2;

loop:

g=search_data();

if(g

do{

puts("\t\t\tModify:

1)Numder");

puts("\t\t\t2)Name");

puts("\t\t\t3)Sex");

puts("\t\t\t4)Age");

puts("\t\t\t5)Duty");

puts("\t\t\t6)Title");

puts("\t\t\t7)Landscape");

puts("\t\t\t8)Qualifications");

puts("\t\t\t9)Servicetime");

puts("\t\t\t10)Cometime");

puts("\t\t\t11)Category");

printf("Pleasechoice:

[]\b\b");

scanf("%d",&w0);}while(w0<1||w0>11);

switch(w0)

{case1:

puts("EnterNewNumber:

");

scanf("%s",h);strcpy(staff[g].num,h);break;

case2:

puts("Entername:

");

scanf("%s",h);strcpy(staff[g].name,h);break;

case3:

puts("Entersex:

");

scanf("%s",h);strcpy(staff[g].sex,h);break;

case4:

puts("Enterage:

");

scanf("%d",&k);staff[g].age=k;break;

case5:

puts("Enterduty:

");

scanf("%s",h);strcpy(staff[g].duty,h);break;

case6:

puts("Entertitile:

");

scanf("%s",h);strcpy(staff[g].title,h);break;

case7:

puts("Enterlandscape:

");

scanf("%s",h);strcpy(staff[g].p_landscape,h);break;

case8:

puts("Enterqualiications:

");

scanf(

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 语文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1