1、高校人事管理系统课程设计一 需求分析1. 目的与意义、2. 系统流程图 1 2 3 4 5 6 8 7 二 总体设计1. 系统功能分析 执行程序后,按界面的显示,选择18种操作。选1,增加人员资料,资料包括编号、职工类别、姓名、性别、年龄、来院时间、职务、职称、党派、学历。选2,删除人员信息。选3,修改人员信息,可以选择要修改的内容。选4,查询人员信息,可按编号或姓名查询。选5,数据存盘。选6,数据装入。选7,显示所有信息。选8,退出。2. 系统功能模块划分与设计 三 详细设计1. 源程序代码#include#include#include#includeclass personprivate
2、: int no;/编号 char type20;/职工类型 char name20;/姓名 char sex10;/性别 int age;/年龄 char time20;/来院时间 char pos20;/职务 char techpos20;/职称 char party20;/党派 char study30;/最高学历 person *mynext;/指针语public: person(int nnum,char ntype,char nname,char nsex,int nage,char ntime,char npos,char ntechpos,char nparty,char ns
3、tudy) no=nnum; strcpy(type,ntype);/将ntype的值复制给type strcpy(name,nname); strcpy(sex,nsex); age=nage; strcpy(time,ntime); strcpy(pos,npos); strcpy(techpos,ntechpos); strcpy(party,nparty); strcpy(study,nstudy); mynext=NULL; person(int nnum,char ntype,char nname,char nsex,int nage,char ntime, char npos,c
4、har ntechpos,char nparty,char nstudy,person *next) /某高校,主要人员有:在职人员(行政人员、教师、一般员工)、退休人员、返聘人员和临时工。 /现在,需要存储这些人员的人事档案信息:编号、姓名、性别、年龄、职务、职称、政治面貌、最高学历、来院时间。 no=nnum; strcpy(type,ntype); strcpy(name,nname); strcpy(sex,nsex); age=nage; strcpy(time,ntime); strcpy(pos,npos); strcpy(techpos,ntechpos); strcpy(pa
5、rty,nparty); strcpy(study,nstudy); mynext=next; void setnext(person *next) mynext=next; person *getnext() return mynext; int getnum() return no; char *getname() return name; char *getsex() return sex; char *getpos() return pos; char *gettechpos() return techpos; char *gettime() return time; char *ge
6、tparty() return party; char *getstudy() return study; int getage() return age; void getag(int as) age=as; char *gettype() return type; ;class Schoolprivate: person *myfirst; int firstnum;public: School()/无参构造函数 myfirst=NULL;/将指针置空 School(int nnu,char ntyp,char nnam,char nse,int nag,char ntim,char np
7、o,char ntechpo,char npart,char nstud)/有参构造函数 myfirst=new person(nnu,ntyp,nnam,nse,nag,ntim,npo,ntechpo,npart,nstud); /在信息最后添加新的信息 void insertatlast(int nnum,char ntype,char nname,char nsex,int nage,char ntime,char npos,char ntechpos,char nparty,char nstudy) person *next=myfirst;/定义对象指针并付初值 if(next=N
8、ULL) myfirst=new person(nnum,ntype,nname,nsex,nage,ntime,npos,ntechpos,nparty,nstudy); else while(next-getnext()!=NULL) next=next-getnext(); next-setnext(new person(nnum,ntype,nname,nsex,nage,ntime,npos,ntechpos,nparty,nstudy,next-getnext(); void printf(int r)/获取信息 int nage; char ntype20,nname20,nse
9、x20,ntime20,npos20,ntechpos20,nparty20,nstudy20; cout请输入编号为r的成员的信息endl; cout输入职工分类码行政人员,教师,一般员工,退休人员,返聘人员,临时工:ntype; cout输入姓名:nname; cout输入性别:nsex; cout输入年龄:nage; cout输入来院时间:ntime; cout输入职务无,科级,处级,地级:npos; cout输入职称无,初级,中级,高级:ntechpos; cout输入加入党派群众,中共党员,民主党派:nparty; cout输入学历小学,初中,高中,大专,大学,硕士,博士:nstud
10、y; insertatlast(r,ntype,nname,nsex,nage,ntime,npos,ntechpos,nparty,nstudy); void printf1(person *ahead)/输出信息 cout编号:setiosflags(ios:left)setw(26)getnum()姓名:getname()endl; cout性别:setiosflags(ios:left)setw(26)getsex()年龄:getage()endl; cout职工类型:setiosflags(ios:left)setw(22)gettype()职务:getpos()endl; cout
11、职称:setiosflags(ios:left)setw(26)gettechpos()学历:getstudy()endl; cout政治面貌:setiosflags(ios:left)setw(22)getparty()来院时间:gettime()endl; void printf() person *ahead=myfirst; cout编号-姓名-性别-年龄-职工类型-职务-职称-学历-政治面貌-来院时间nendl; while(ahead!=NULL) coutsetiosflags(ios:left)setw(4)getnum()setiosflags(ios:left)setw(6
12、)getname() ; coutsetiosflags(ios:left)setw(5)getsex()setiosflags(ios:left)setw(4)getage() ;coutsetiosflags(ios:left)setw(10)gettype()setiosflags(ios:left)setw(6)getpos() ; coutsetiosflags(ios:left)setw(6)gettechpos()setiosflags(ios:left)setw(6)getstudy();coutsetiosflags(ios:left)setw(9)getparty()set
13、iosflags(ios:left)setw(12)gettime()getnext(); void add()/添加新信息 int i,a,b; person *p1=myfirst; if(p1=NULL) couti; printf(i); else if(p1-getnext()=NULL)/如果p1的后继指针为空,则执行“printf(a)” a=p1-getnum()+1; printf(a); else while(p1-getnext()!=NULL)/p1的后继指针不为空,则执行“printf(b)” p1=p1-getnext(); b=p1-getnum()+1; pri
14、ntf(b); bool removedatnum( )/删除信息 int bh; person *ahead=myfirst; person *follow=ahead; coutbh; if(ahead=NULL) return false; else if(ahead-getnum()=bh) myfirst=myfirst-getnext(); cout编号为bh的成员以被删除getnext(); while(ahead!=NULL) if(ahead-getnum()=bh) follow-setnext(ahead-getnext(); cout编号为bhgetnext(); co
15、ut要删除的成员不存在!endl; return false; bool find1()/按编号查找 int id; person *ahead=myfirst; person *follow=ahead; cout请输入编号:id; cout*endl; if(ahead=NULL) cout无人员信息!getnum()=id) printf1(ahead); return true; else follow=ahead; ahead=ahead-getnext(); cout无此人信息:endl; return false; bool find2( )/按姓名查找 char nm20; p
16、erson *ahead=myfirst; person *follow=ahead; coutnm; cout*endl; if(ahead=NULL) cout无人员信息getname(),nm)=0) printf1(ahead); return true; else follow=ahead; ahead=ahead-getnext(); cout查无此人:endl; return false; bool upperson()/修改信息 int iid; person *ahead=myfirst; person *follow=ahead; coutiid; if(ahead=NUL
17、L) cout无人员信息getnum()=iid) printf1(ahead); int nu=-1; for(int i=1;nu!=0;i+) int ml; int mll; char ty30; cout请选择要修改的内容:endl; cout 1:姓名2:性别3:年龄4:职工类型 5:职务endl; cout6:职称 7:学历 8:政治面貌 9:来院时间endl; coutml; switch(ml) case 1: coutty; strcpy(follow-getname(),ty); ;break; case 2: coutty; strcpy(ahead-getsex(),
18、ty); ;break; case 3: coutmll; ahead-getag(mll); ;break; case 4: coutty; strcpy(ahead-gettype(),ty); ; break; case 5: coutty; strcpy(ahead-getpos(),ty); ;break; case 6: coutty; strcpy(ahead-gettechpos(),ty); ;break; case 7: coutty; strcpy(ahead-getstudy(),ty); ;break; case 8: coutty; strcpy(ahead-get
19、party(),ty); ;break; case 9: coutty; strcpy(ahead-gettime(),ty); ;break; return true; else ahead=ahead-getnext(); follow=ahead; cout没有此人nnumntypennamensexnagentimenposntechposnpartynstudy; insertatlast(nnum,ntype,nname,nsex,nage,ntime,npos,ntechpos,nparty,nstudy); fperson.close(); coutn人员和相关数据已经装入.n
20、; void save()/保存文件到文件中 ofstream fperson; fperson.open(person.txt,ios:out); person *p=myfirst; while(p) fpersongetnum()tgettype()tgetname()tgetsex()tgetage()tgettime()tgetpos()tgettechpos()tgetparty()tgetstudy(); fpersongetnext(); fperson.close(); cout保存数据已经完成getnext(); delete temp; myfirst=NULL; ;void main() School s;/定义对象 int c; do cout*endl; cout 高校人事管理系统
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1