1 / 15
文档名称:

员工管理系统数据结构课程设计.pdf

格式:pdf   大小:199KB   页数:15页
下载后只包含 1 个 PDF 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

员工管理系统数据结构课程设计.pdf

上传人:小辰GG1 2023/3/25 文件大小:199 KB

下载得到文件列表

员工管理系统数据结构课程设计.pdf

文档介绍

文档介绍:该【员工管理系统数据结构课程设计 】是由【小辰GG1】上传分享,文档一共【15】页,该文档可以免费在线阅读,需要了解更多关于【员工管理系统数据结构课程设计 】的内容,可以使用淘豆网的站内搜索功能,选择自己适合的文档,以下文字是截取该文章内的部分文字,如需要获得完整电子版,请下载此文档到您的设备,方便您编辑和打印。:.
/**/
#include""
#include""
#include""
#defineTRUE1
#defineFALSE0
#defineOK1
#defineERROR0
#defineOVERFLOW-2
typedefstructLNode
{
charid[20];
charname[10];
charsex[10];
charbirth[10];
charedu[10];
charduty[10];
charphone[20];
charaddress[30];
structLNode*next;
}LNode,*Linklist;//定义节点类型
intCreatList(Linklist&L)
{
Linklistp;
p=(Linklist)malloc(sizeof(LNode));
if(!p)
{
return(0);
}
else
{
printf("请输入员工编号\n");
scanf("%s",p->id);
printf("请输入员工姓名\n");
scanf("%s",p->name);
printf("请输入员工性别\n");
scanf("%s",p->sex);
printf("请输入员工生日\n");
scanf("%s",p->birth);
printf("请输入员工学历\n");
scanf("%s",p->edu);
printf("请输入员工职务\n");:.
scanf("%s",p->duty);
printf("请输入员工电话\n");
scanf("%s",p->phone);
printf("请输入员工地址\n");
scanf("%s",p->address);
}
p->next=L->next;
L->next=p;
}//头插法生成单链表
intInitlist(Linklist&L)
{
L=(Linklist)malloc(sizeof(LNode));
if(!L)
return(0);
L->next=NULL;
returnOK;
}//初始化单链表
voidDisplay(Linklist&L)
{
Linklistp;
for(p=L->next;p;p=p->next)
{
printf("编号%s\n",p->id);
printf("姓名%s\n",p->name);
printf("性别%s\n",p->sex);
printf("生日%s\n",p->birth);
printf("学历%s\n",p->edu);
printf("职务%s\n",p->duty);
printf("电话%s\n",p->phone);
printf("地址%s\n",p->address);
printf("============================\n");
}
}//显示所有员工信息
intSearchID(Linklist&L,charid[20])
{
LNode*p;
p=L;
while(p):.
{
if(strcmp(p->id,id)==0)
{
printf("编号%s\n",p->id);
printf("姓名%s\n",p->name);
printf("性别%s\n",p->sex);
printf("生日%s\n",p->birth);
printf("学历%s\n",p->edu);
printf("职务%s\n",p->duty);
printf("电话%s\n",p->phone);
printf("地址%s\n",p->address);
}
p=p->next;
}
returnOK;
}//ID查询
intSearchName(Linklist&L,charname[10])
{
LNode*p;
p=L;
while(p)
{
if(strcmp(p->name,name)==0)
{
printf("编号%s\n",p->id);
printf("姓名%s\n",p->name);
printf("性别%s\n",p->sex);
printf("生日%s\n",p->birth);
printf("学历%s\n",p->edu);
printf("职务%s\n",p->duty);
printf("电话%s\n",p->phone);
printf("地址%s\n",p->address);
}
p=p->next;
}
returnOK;
}//姓名查询
voidSortID(Linklist&L,charid[20])
{
LinklistLa;
Linklistp,q,m;
La=(Linklist)malloc(sizeof(LNode));:.
La->next=NULL;
while(L->next)
{
for(q=L->next,p=L->next;p->next;p=p->next)
{
if((strcmp(p->next->id,q->id))>0)
{
m=p;
q=p->next;
}
}
if(q==L->next)
{
L->next=L->next->next;
}
else
{
m->next=q->next;
}
q->next=La->next;
La->next=q;
}
L=La;
Display(L);
}//编号排序
voidSortName(Linklist&L,charname[10])
{
LinklistLa;
Linklistp,q,m;
La=(Linklist)malloc(sizeof(LNode));
La->next=NULL;
while(L->next)
{
for(q=L->next,p=L->next;p->next;p=p->next)
{:.
if((strcmp(p->next->name,q->name))>0)
{
m=p;
q=p->next;
}
}
if(q==L->next)
{
L->next=L->next->next;
}
else
{
m->next=q->next;
}
q->next=La->next;
La->next=q;
}
L=La;
Display(L);
}//姓名排序
voidSortSex(Linklist&L,charsex[10])
{
LinklistLa;
Linklistp,q,m;
La=(Linklist)malloc(sizeof(LNode));
La->next=NULL;
while(L->next)
{
for(q=L->next,p=L->next;p->next;p=p->next)
{
if((strcmp(p->next->sex,q->sex))>0)
{
m=p;
q=p->next;
}
}:.
if(q==L->next)
{
L->next=L->next->next;
}
else
{
m->next=q->next;
}
q->next=La->next;
La->next=q;
}
L=La;
Display(L);
}//性别排序
voidSortBirth(Linklist&L,charbirth[10])
{
LinklistLa;
Linklistp,q,m;
La=(Linklist)malloc(sizeof(LNode));
La->next=NULL;
while(L->next)
{
for(q=L->next,p=L->next;p->next;p=p->next)
{
if((strcmp(p->next->birth,q->birth))>0)
{
m=p;
q=p->next;
}
}
if(q==L->next)
{
L->next=L->next->next;
}
else
{:.
m->next=q->next;
}
q->next=La->next;
La->next=q;
}
L=La;
Display(L);
}//出生年月排序
voidSortEdu(Linklist&L,charedu[10])
{
LinklistLa;
Linklistp,q,m;
La=(Linklist)malloc(sizeof(LNode));
La->next=NULL;
while(L->next)
{
for(q=L->next,p=L->next;p->next;p=p->next)
{
if((strcmp(p->next->edu,q->edu))>0)
{
m=p;
q=p->next;
}
}
if(q==L->next)
{
L->next=L->next->next;
}
else
{
m->next=q->next;
}
q->next=La->next;
La->next=q;
}
L=La;:.
Display(L);
}//学历排序
voidSortDuty(Linklist&L,charduty[10])
{
LinklistLa;
Linklistp,q,m;
La=(Linklist)malloc(sizeof(LNode));
La->next=NULL;
while(L->next)
{
for(q=L->next,p=L->next;p->next;p=p->next)
{
if((strcmp(p->next->duty,q->duty))>0)
{
m=p;
q=p->next;
}
}
if(q==L->next)
{
L->next=L->next->next;
}
else
{
m->next=q->next;
}
q->next=La->next;
La->next=q;
}
L=La;
Display(L);
}//职务排序
voidSortPhone(Linklist&L,charphone[20])
{
LinklistLa;
Linklistp,q,m;:.
La=(Linklist)malloc(sizeof(LNode));
La->next=NULL;
while(L->next)
{
for(q=L->next,p=L->next;p->next;p=p->next)
{
if((strcmp(p->next->phone,q->phone))>0)
{
m=p;
q=p->next;
}
}
if(q==L->next)
{
L->next=L->next->next;
}
else
{
m->next=q->next;
}
q->next=La->next;
La->next=q;
}
L=La;
Display(L);
}//电话排序
voidSortAddress(Linklist&L,charaddress[30])
{
LinklistLa;
Linklistp,q,m;
La=(Linklist)malloc(sizeof(LNode));
La->next=NULL;
while(L->next)
{
for(q=L->next,p=L->next;p->next;p=p->next):.
{
if((strcmp(p->next->address,q->address))>0)
{
m=p;
q=p->next;
}
}
if(q==L->next)
{
L->next=L->next->next;
}
else
{
m->next=q->next;
}
q->next=La->next;
La->next=q;
}
L=La;
Display(L);
}//地址排序
intAlter(Linklist&L,charid[20])
{
LNode*p;
p=L;
while(p)
{
if(strcmp(p->id,id)==0)
{
printf("请输入员工编号\n");
scanf("%s",p->id);
printf("请输入员工姓名\n");
scanf("%s",p->name);
printf("请输入员工性别\n");
scanf("%s",p->sex);
printf("请输入员工生日\n");
scanf("%s",p->birth);
printf("请输入员工学历\n");
scanf("%s",p->edu);:.
printf("请输入员工职务\n");
scanf("%s",p->duty);
printf("请输入员工电话\n");
scanf("%s",p->phone);
printf("请输入员工地址\n");
scanf("%s",p->address);
}
p=p->next;
}
returnOK;
}//更改
intDel(Linklist&L,charid[20])
{
LNode*p;
LNode*r;
p=L->next;
r=L;
while(!(strcmp(p->id,id)==0)&&p)
{
r=p;
p=p->next;
}
if(!p)
printf("\n删除位置不合理\n");
else
{
r->next=p->next;
free(p);
printf("删除成功\n");
}
returnOK;
}//按ID删除
//主函数
voidmain()
{
LinklistL;
inta;
charm;
charname[10];
charid[20];
charsex[10];:.
charbirth[10];
charedu[10];
charduty[10];
charphone[20];
charaddress[30];
Initlist(L);
inty;
intx=1;
while(x)
{
printf("****************************\n");
printf("欢迎进入员工管理系统!\n");
printf("****************************\n");
printf("1-添加员工信息\n");
printf("2-查询员工信息\n");
printf("3-排序员工信息\n");
printf("4-显示所有员工信息\n");
printf("5-更改员工信息\n");
printf("6-删除员工信息\n");
printf("7-退出\n");
printf("****************************\n");
printf("请选择操作序号并按回车:");
scanf("%d",&y);
switch(y)
{
case1:CreatList(L);
do
{
printf("是否继续输入?(y/n)");
getchar();
scanf("%c",&m);
if(m=='y')
{
CreatList(L);
}
}
while(m!='n');
break;
case2:printf("请输入查询方式(1按编号查询,2按姓名查找)");
scanf("%d",&a);
if(a==1)
{
printf("请输入查询员工编号\n");:.
scanf("%s",&id);
SearchID(L,id);
}
if(a==2)
{
printf("请输入查询员工姓名\n");
scanf("%s",&name);
SearchName(L,name);
}
break;
case3:printf("请选择排序条件:
\n");
scanf("%d",&a);
if(a==1)
{
printf("编号排序\n");
SortID(L,id);
}
if(a==2)
{
printf("姓名排序\n");
SortName(L,name);
}
if(a==3)
{
printf("性别排序\n");
SortSex(L,sex);
}
if(a==4)
{
printf("出生年月排序\n");
SortBirth(L,birth);
}
if(a==5)
{
printf("姓名排序\n");
SortDuty(L,duty);
}
if(a==6):.
{
printf("姓名排序\n");
SortEdu(L,edu);
}
if(a==7)
{
printf("姓名排序\n");
SortPhone(L,phone);
}
if(a==8)
{
printf("姓名排序\n");
SortAddress(L,address);
}
break;
case4:printf("所有员工信息如下所示\n");
Display(L);
break;
case5:printf("请输入更改员工编号");
getchar();
scanf("%s",&id);
Alter(L,id);
break;
case6:printf("请输入删除员工编号");
getchar();
scanf("%s",&id);
Del(L,id);
break;
case7:x=0;
break;
default:
printf("请输入正确序号!\n");
break;
}
}
:.
}