您好,欢迎来到飒榕旅游知识分享网。
搜索
您的当前位置:首页高校人事管理系统课程设计报告

高校人事管理系统课程设计报告

来源:飒榕旅游知识分享网
. -

一. 需求分析

1. 目的与意义

、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、 2. 系统流程图 1 2 增加人员资料 3 4 数据存盘 修改人员信息 删除人员信息 高校人事管理系统 选择要进 56 查询人员信息 行的操作 数据装入 8 7 退出

显示所有信息 二. 总体设计

1. 系统功能分析

执行程序后,按界面的显示,选择1—8种操作。选1,增加人员资料,资料包括编号、职工类别、、性别、年龄、来院时间、职务、职称、党派、学历。选2,删除人员信息。选3,修改人员信息,可以选择要修改的容。选4,查询人员信息,可按编号或查询。选5,数据存盘。选6,数据装入。选7,显示所有信息。选8,退出。

2. 系统功能模块划分与设计

添删除功能 修改功能 查询功能 盘与装入功能 数据存 显示功能 高校人事管理系统

加功能 . .可修编.

. -

三. 详细设计

1. 源程序代码

#include #include #include #include class person { private:

int no;//编号

char type[20];//职工类型

char name[20];// char sex[10];//性别 int age;//年龄 char time[20];//来院时间 char pos[20];//职务 char techpos[20];//职称 char party[20];//党派 char study[30];//最高学历

.

.可修编.

. -

person *mynext;//指针语

public:

person(int nnum,char ntype[],char nname[],char nsex[],int nage,char ntime[],char

npos[],char ntechpos[],char nparty[],char nstudy[])

{

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[],char 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(party,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 *getparty() { return party;

}

char *getstudy() {

return study; } int getage() { return age;

}

void getag(int as) { age=as; }

char *gettype() { return type;

}

. .可修编.

. -

};

class School { private:

person *myfirst; int firstnum;

public:

School()//无参构造函数 { }

School(int nnu,char ntyp[],char nnam[],char nse[],int nag,char ntim[],char

myfirst=NULL;//将指针置空

npo[],char ntechpo[],char npart[],char nstud[])//有参构造函数

{ }

//在信息最后添加新的信息

void insertatlast(int nnum,char ntype[],char nname[],char nsex[],int nage,char

myfirst=new person(nnu,ntyp,nnam,nse,nag,ntim,npo,ntechpo,npart,nstud);

ntime[],char npos[],char ntechpos[],char nparty[],char nstudy[])

{

person *next=myfirst;//定义对象指针并付初值 if(next==NULL)

. .可修编.

. -

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 }

ntype[20],nname[20],nsex[20],ntime[20],npos[20],ntechpos[20],nparty[20],nstudy[20];

cout<<\"请输入编号为\"<cout<<\"输入职工分类码[行政人员,教师,一般员工,退休人员,返聘人员,临时工]:\"<>ntype; cout<<\"输入:\"<. .可修编.

. -

cin>>nname;

cout<<\"输入性别:\"<>nsex;

cout<<\"输入年龄:\"<>nage;

cout<<\"输入来院时间:\"<>ntime;

cout<<\"输入职务[无,科级,处级,地级]:\"<>npos;

cout<<\"输入职称[无,初级,中级,高级]:\"<>ntechpos;

cout<<\"输入加派[群众,,党派]:\"<>nparty;

cout<<\"输入学历[小学,初中,高中,大专,大学,硕士,博士]:\"<>nstudy;

}

void printf1(person *ahead)//输出信息 {

cout<<\"编

insertatlast(r,ntype,nname,nsex,nage,ntime,npos,ntechpos,nparty,nstudy);

号:\"<getnum()<<\":\"<getname()<. .可修编.

. -

cout<<\"性别:\"<getsex()<<\"年

龄:\"<getage()<cout<<\"职工类型:\"<gettype()<<\"职

务:\"<getpos()<cout<<\"职称:\"<gettechpos()<<\"学历:\"<getstudy()<cout<<\"政治面貌:\"<getparty()<<\"来院时间:\"<gettime()<}

void printf() {

person *ahead=myfirst;

cout<<\"编号------性别---年龄---职工类型---职务---职称---学历---

政治面貌---来院时间\\n\"<while(ahead!=NULL)

{ cout<getnum()<getname() ;

cout<getsex()<getage() ;cout<gettype()<getpos() ;

cout<gettechpos()<getstudy();

. .可修编.

. -

cout<getparty()<gettime()<getnext();

}

void add()//添加新信息 {

int i,a,b;

person *p1=myfirst; if(p1==NULL) {

cout<<\"请输入编号:\"; }

cin>>i; 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; printf(b);

}

}

}

bool removedatnum( )//删除信息 {

int bh; person *ahead=myfirst; person *follow=ahead;

cout<<\"请输入要删除人员的编号:\"; cin>>bh; if(ahead==NULL)

return false;

else

. .可修编.

. -

if(ahead->getnum()==bh) { } else {

ahead=ahead->getnext(); while(ahead!=NULL) { }

if(ahead->getnum()==bh) {

follow->setnext(ahead->getnext());

myfirst=myfirst->getnext();

cout<<\"编号为\"<cout<<\"编号为\"<follow=ahead;

ahead=ahead->getnext();

. .可修编.

. -

}

}

cout<<\"要删除的成员不存在!\"<bool find1()//按编号查找 {

int id;

person *ahead=myfirst; person *follow=ahead; cout<<\"请输入编号:\"<>id;

cout<<\"**********************************\"<if(ahead==NULL) { } else {

while(ahead!=NULL) {

if(ahead->getnum()==id) cout<<\"无人员信息!\"<. .可修编.

. -

}

}

}

{ } else { }

follow=ahead;

ahead=ahead->getnext(); printf1(ahead); return true;

cout<<\"无此人信息:\"<bool find2( )//按查找 {

char nm[20];

person *ahead=myfirst; person *follow=ahead; cout<<\"输入\"; cin>>nm;

cout<<\"**********************************\"<. .可修编.

. -

if(ahead==NULL) { } else {

while(ahead!=NULL) { }

cout<<\"查无此人:\"<if(strcmp(ahead->getname(),nm)==0) { } else { }

follow=ahead;

ahead=ahead->getnext(); printf1(ahead); return true;

cout<<\"无人员信息\"<. .可修编.

. -

}

}

bool upperson()//修改信息 {

int iid;

person *ahead=myfirst; person *follow=ahead;

cout<<\"请输入要修改人员的编号:\"; cin>>iid; if(ahead==NULL) { cout<<\"无人员信息\"<} else { while(ahead!=NULL) { if(ahead->getnum()==iid) { printf1(ahead);

int nu=-1;

. .可修编.

. -

for(int i=1;nu!=0;i++) {

int ml;

int mll; char ty[30];

cout<<\"请选择要修改的容:\"<cout<<\" 1:2:性别3:年龄4:职工类型5:职务\"<>ml; switch(ml)

{ case 1:

{

cout<<\"请输入:\"; cin>>ty;

strcpy(follow->getname(),ty);

};break;

case 2:

{

cout<<\"请输入性别:\";

cin>>ty;

. .可修编.

. -

strcpy(ahead->getsex(),ty);

};break;

case 3:

{

cout<<\"请输入年龄:\";

. cin>>mll; ahead->getag(mll);

};break;

case 4: {

cout<<\"请输入职工类型:\";

cin>>ty; strcpy(ahead->gettype(),ty);

}; break;

case 5: {

cout<<\"请输入职务:\";

cin>>ty;

strcpy(ahead->getpos(),ty);

};break;

case 6:

{

.可修编.

. -

cout<<\"请输入职称:\";

cin>>ty;

{

.

strcpy(ahead->gettechpos(),ty);

};break;

case 7: { cout<<\"请输入学历:\"; cin>>ty;

strcpy(ahead->getstudy(),ty);

};break;

case 8:

cout<<\"请输入政治面貌:\"; cin>>ty;

strcpy(ahead->getparty(),ty);

};break;

case 9: { cout<<\"请输入来院时间:\"; cin>>ty;

strcpy(ahead->gettime(),ty);

};break;

.可修编.

. -

}

}

}

}

}

}

return true;

else { }

ahead=ahead->getnext(); follow=ahead;

cout<<\"没有此人\"<void load() {

int nnum,nage; char

ntype[20],nname[20],nsex[20],ntime[20],npos[20],ntechpos[20],nparty[20],nstudy[20];

ifstream fperson;

fperson.open(\"person.txt\

. .可修编.

. -

while(fperson.good()) {

fperson>>nnum>>ntype>>nname>>nsex>>nage>>ntime>>npos>>ntechpos>>npart

y>>nstudy;

insertatlast(nnum,ntype,nname,nsex,nage,ntime,npos,ntechpos,nparty,nstudy);

}

void save()//保存文件到文件中 {

fperson<getnum()<<\"\\"<gettype()<<\"\\"<getname()<<\"\\"<getse

ofstream fperson;

fperson.open(\"person.txt\person *p=myfirst; while(p) { }

fperson.close();

cout<<\"\\n人员和相关数据已经装入.....\\n\";

x()<<\"\\"<getage()<<\"\\"<gettime()<<\"\\"<getpos()<<\"\\"<gettechpos()<<\"\\"<getparty()<<\"\\"<getstudy();

fperson<. .可修编.

. -

p=p->getnext();

}

fperson.close();

cout<<\"保存数据已经完成\"<}

~School()//析构函数,删除各指针! {person *next=myfirst,*temp; while(next!=NULL) { temp=next;

next=next->getnext(); delete temp;

}

myfirst=NULL; }

};

void main() { School s;//定义对象 int c; do

{

. .可修编.

. -

cout<<\"**************************************************\"<cout<<\" 高校人事管理系统 \"<cin>>c; switch(c) {

case 1:s.add(); break; case 2:s.removedatnum(); break; case 3:s.upperson(); break; case 4:{

int nm;

cout<<\"1-通过编号。2-通过。请选择:\";

. .可修编.

. -

}

cin>>nm; if(nm==1)

s.find1();

else

s.find2();

};break;

case 5: s.save();break; case 6: s.load();break; case 7: s.printf();break; }

}while(c!=8);

2. 类层次图

数据成员:

int no,char type[20], char name[20], char sex[10], int age, char time[20], char pos[20], char techpos[20], char party[20], char study[30]

person *mynext

函数:

person(int nnum,char ntype[],char nname[],char nsex[],int nage,char ntime[],char npos[],char ntechpos[],char nparty[],char nstudy[])

class personperson(int nnum,char ntype[],char nname[],char nsex[],int nage,char ntime[],

char npos[],char ntechpos[],char nparty[],char

. .可修编.

. -

nstudy[],person *next) void setnext(person *next)person *getnext() int getnum()char *getname() char *getsex()char *getpos() char *gettechpos()char *gettime() char *getparty()char *getstudy() int getage()void getag(int as) char *gettype()

数据成员:

person *myfirst,int firstnum 函数

School()

School(int nnu,char ntyp[],char nnam[],char nse[],int nag,char ntim[],char npo[],char ntechpo[], char npart[],char nstud[]) void insertatlast(int nnum,char ntype[],char nname[],char nsex[],int nage,char ntime[] ,char npos[],char ntechpos[],char nparty[], char nstudy[])

class Schoolvoid printf(int r)

void printf1(person *ahead) void printf() void add()

bool removedatnum( )

. .可修编.

. -

bool find1() bool find2( ) bool upperson() void load() void save() ~School()

四.界面设计与各功能模块实现

1.界面设计

cout<<\"**************************************************\"<2.各功能模块实现

添加功能

. .可修编.

. -

void add()//添加新信息

{

int i,a,b;

person *p1=myfirst; if(p1==NULL) {

cout<<\"请输入编号:\";

cin>>i; printf(i);

} else {

if(p1->getnext()==NULL)//如果p1的后继指针为空,则执行“printf(a)” { } else {

while(p1->getnext()!=NULL)//p1的后继指针不为空,则执行a=p1->getnum()+1; printf(a);

“printf(b)”

{

. .可修编.

. -

}

}

}

}

p1=p1->getnext();

b=p1->getnum()+1; printf(b);

删除功能

bool removedatnum( )

{

int bh;

person *ahead=myfirst; person *follow=ahead;

cout<<\"请输入要删除人员的编号:\"; cin>>bh;

if(ahead==NULL)

return false;

else

if(ahead->getnum()==bh) {

myfirst=myfirst->getnext();

cout<<\"编号为\"<. .可修编.

. -

}

delete ahead; return true;

else {

}

}

. ahead=ahead->getnext(); while(ahead!=NULL) { if(ahead->getnum()==bh) {

follow->setnext(ahead->getnext());

cout<<\"编号为\"<follow=ahead;

ahead=ahead->getnext();

}

cout<<\"要删除的成员不存在!\"< .可修编.

. -

修改功能 bool upperson() {

int iid;

person *ahead=myfirst; person *follow=ahead;

cout<<\"请输入要修改人员的编号:\"; cin>>iid; if(ahead==NULL) { cout<<\"无人员信息\"<} else { while(ahead!=NULL) { if(ahead->getnum()==iid) { printf1(ahead); int nu=-1;

for(int i=1;nu!=0;i++)

. .可修编.

. -

{

int ml;

int mll; char ty[30];

cout<<\"请选择要修改的容:\"<

. cout<<\" 1:2:性别3:年龄4:职工类型 5:职务\"<>ml; switch(ml) { case 1: { cout<<\"请输入:\";

cin>>ty;

strcpy(follow->getname(),ty);

};break;

case 2: {

cout<<\"请输入性别:\";

cin>>ty;

strcpy(ahead->getsex(),ty);

.可修编.

. -

};break;

case 3:

{

cout<<\"请输入年龄:\";

cin>>mll;

. ahead->getag(mll);

};break;

case 4: {

cout<<\"请输入职工类型:\";

cin>>ty;

strcpy(ahead->gettype(),ty);

}; break;

case 5: {

cout<<\"请输入职务:\";

cin>>ty;

strcpy(ahead->getpos(),ty);

};break;

case 6: {

cout<<\"请输入职称:\";

.可修编.

. -

cin>>ty;

.

strcpy(ahead->gettechpos(),ty);

};break;

case 7: { cout<<\"请输入学历:\"; cin>>ty;

strcpy(ahead->getstudy(),ty);

};break;

case 8: { cout<<\"请输入政治面貌:\"; cin>>ty;

strcpy(ahead->getparty(),ty);

};break;

case 9: { cout<<\"请输入来院时间:\"; cin>>ty;

strcpy(ahead->gettime(),ty);

};break;

}

.可修编.

. -

return true;

}

}

else { ahead=ahead->getnext(); follow=ahead;

}

}

cout<<\"没有此人\"<}

}

查询功能

1.按编号查询

bool find1() {

int id;

person *ahead=myfirst; person *follow=ahead; cout<<\"请输入编号:\"<>id;

. .可修编.

. -

cout<<\"**********************************\"<} else { while(ahead!=NULL) { if(ahead->getnum()==id) { printf1(ahead); return true;

} else { follow=ahead;

ahead=ahead->getnext(); }

}

cout<<\"无此人信息:\"<. .可修编.

. -

}

}

return false;

2.按查询

bool find2( )

{

char nm[20];

person *ahead=myfirst; person *follow=ahead; cout<<\"输入\"; cin>>nm;

cout<<\"**********************************\"<if(ahead==NULL) { } else {

while(ahead!=NULL) {

if(strcmp(ahead->getname(),nm)==0) cout<<\"无人员信息\"<. .可修编.

. -

{ printf1(ahead); return true;

} else { follow=ahead;

ahead=ahead->getnext(); }

}

cout<<\"查无此人:\"<}

}

数据存盘功能 void save() { ofstream fperson;

fperson.open(\"person.txt\ person *p=myfirst; while(p)

{

. .可修编.

. -

fperson<getnum()<<\"\\"<gettype()<<\"\\"<getname()<<\"\\"<getse

x()<<\"\\"<getage()<<\"\\"<gettime()<<\"\\"<getpos()<<\"\\"<gettechpos()<<\"\\"<getparty()<<\"\\"<getstudy();

数据装入功能 void load()

{

int nnum,nage; char }

}

fperson.close();

cout<<\"保存数据已经完成\"<fperson<getnext();

ntype[20],nname[20],nsex[20],ntime[20],npos[20],ntechpos[20],nparty[20],nstudy[20];

ifstream fperson;

fperson.open(\"person.txt\while(fperson.good()) {

. .可修编.

. -

fperson>>nnum>>ntype>>nname>>nsex>>nage>>ntime>>npos>>ntechpos>>npart

y>>nstudy;

insertatlast(nnum,ntype,nname,nsex,nage,ntime,npos,ntechpos,nparty,nstudy);

}

}

fperson.close();

cout<<\"\\n人员和相关数据已经装入.....\\n\";

显示功能

void printf() {

person *ahead=myfirst;

cout<<\"编号------性别---年龄---职工类型---职务---职称---学历---

政治面貌---来院时间\\n\"<while(ahead!=NULL)

{ cout<getnum()<getname() ;

cout<getsex()<getage() ;cout<gettype()<getpos() ;

cout<gettechpos()<getstudy();

. .可修编.

. -

cout<getparty()<gettime()<getnext();

}

}

五. 系统调试

1. 没有调用#include导致strcpy()操作不合法。 2. 、、、、、、、、

六. 使用说明及编程体会

1. 使用说明

运行程序后,选择1-8操作中的一种。

选1,增加人员资料。需输入编号、职工分类码、、性别、年龄、来院时间、职务、职称、加派、学历。

选2,删除人员信息。输入要删除人员的编号。假如此人员存在,会输出“编号为**的成员已被删除”假如人员不存在,会输出“要删除的成员不存在!” 选3,修改人员信息。输入要修改人员的编号,假如此人员存在,需要选择要修改的容,包括、性别、年龄、职工类型、职务、职称、学历、政治面貌、来院时间。假如人员不存在,输出“没有此人”

选4,查询人员信息。要选择查询的方式。1通过编号,2通过。选1,输入要查的编号。假如此人员存在,会输出要相关人员信息。假如人员不存在,会输出“无此人信息:”选2,输如要查的。假如此人员存在,会输出要相关人员信息。假如人员不存在,会输出“查无此人:”。

. .可修编.

. -

选5,数据存盘。会自动存盘,并输出“**人员和相关数据已经装入.....”。 选6,数据装入。会自动装入数据,并输出“保存数据已完成”。 选7,显示所有信息。会输出系统所存的所有员工的各项信息。 选8,退出。

2. 编程体会

、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、

. .可修编.

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- sarr.cn 版权所有 赣ICP备2024042794号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务