c++学校人员信息管理系统Word下载.docx

上传人:b****2 文档编号:13325301 上传时间:2022-10-09 格式:DOCX 页数:26 大小:130.29KB
下载 相关 举报
c++学校人员信息管理系统Word下载.docx_第1页
第1页 / 共26页
c++学校人员信息管理系统Word下载.docx_第2页
第2页 / 共26页
c++学校人员信息管理系统Word下载.docx_第3页
第3页 / 共26页
c++学校人员信息管理系统Word下载.docx_第4页
第4页 / 共26页
c++学校人员信息管理系统Word下载.docx_第5页
第5页 / 共26页
点击查看更多>>
下载资源
资源描述

c++学校人员信息管理系统Word下载.docx

《c++学校人员信息管理系统Word下载.docx》由会员分享,可在线阅读,更多相关《c++学校人员信息管理系统Word下载.docx(26页珍藏版)》请在冰豆网上搜索。

c++学校人员信息管理系统Word下载.docx

//把文件从硬盘上读入存

voidfileWrite(chainList*list,ofstream&

//写入硬盘

intcompareStr(char*str1,char*str2);

//名字作为关键字,这个函数就用来比较

voidaddList(chainList*list);

//同名的话,覆盖,或者改为新名字加入

voiddeleteNode(chainList*node);

//根据名字删除

voideditList(chainList*list,char*name);

//要编辑的人名和新的资料

chainList*searchList(chainList*list,char*name);

//只提供名字查询(其他以后加入)

//返回前一个节点的指针

voidorderList(chainList*list);

//按名字排序

voidorderListByAge(chainList*list);

//按年龄降序排列

voidorderListBySex(chainList*list);

//按照性别排列,女士优先

voidprintStaticInfo(chainList*list);

voidprintList(chainList*list);

intmain()

{cout<

<

"

\tYouarewelcometothemanagementsystem!

endl;

cout<

Doyouwanttoloadafileorsetupanewlist?

Presslors."

charsn;

cin>

>

sn;

charfileName[30];

chainListheadNode(0,NULL);

chainList*head=&

headNode;

if(sn=='

l'

{ifstreamfile;

cout<

File'

sname:

cin>

fileName;

file.open(fileName);

if(!

file)//为何输入不存在地文件后,机子变得很慢,而且没有结果出来?

{cout<

Filenotfound!

Systemexit."

return1;

}

//cout<

test"

//竟然通过!

file的检查?

(文件不存在阿)

fileRead(head,file);

//读入文件到链表

file.close();

}

printStaticInfo(head);

charctn;

do

{cout<

mainmenu:

\t1.Addaperson.2.Deleteaperson3.Editaperson"

\t4.Searchaperson5.Orderthelist6.Printinfoaboutthelist"

\t0.exit"

ctn;

switch(ctn)

{

case'

0'

:

break;

1'

addList(head);

break;

2'

cout<

Pleaseinputtheperson'

snametobedeleted:

charnm[20];

cin>

nm;

chainList*pdel;

pdel=searchList(head,nm);

charsure;

//Makesurewhetheryouwanttodeletethedata

sure='

n'

;

if(!

pdel->

next)

{

cout<

Thepersonyouinputcann'

tbefound"

}

else{

Thepersonsinforfollows:

pdel->

next->

pl->

print();

Areyousuretodeleteit?

Pressyorn"

cin>

sure;

if(sure=='

y'

{

deleteNode(pdel);

cout<

nm<

havebeendeleted!

}

3'

charnm1[20];

nm1;

chainList*pp;

pp=searchList(head,nm1);

if(pp->

Theperson'

sinforfollows:

pp->

Now,pleaseedittheinfors."

editList(head,nm1);

else

Thepersoncan'

tbefound!

!

4'

charname[30];

name;

chainList*p;

p=searchList(head,name);

if(p->

p->

tbefound!

5'

Youwanttoorderthelistby:

1.name2.age3.sex(ladyfirst)"

charch;

ch;

switch(ch)

case'

Youchoosetoorderthelistbyname.Theresultareasfollows:

orderList(head);

printStaticInfo(head);

break;

Youchoosetoorderthelistbyage.Theresultareasfollows:

orderListByAge(head);

Youchoosetoorderthelistbysex.Theresultareasfollows:

orderListBySex(head);

default:

Wrongchoice!

6'

printStaticInfo(head);

default:

}while(ctn!

='

);

Doyouwanttosavethefile?

No,pressn.Else,anyotherkey."

charsave;

save;

if(save!

{

Pleaseinputthefile'

ofstreamfin;

fin.open(fileName);

//如果文件已经存在,询问是否覆盖。

如何知道是否存在

if(!

fin)

Can'

topenoutputfile.\n"

fileWrite(head,fin);

fin.close();

Filehasbeensuccessfullysaved!

Byebye!

return0;

}

ff)

{

chainList*p=list;

inttp;

charnm[20];

intag;

charsx;

intslr;

intgrd;

inte;

intm;

intg;

intaverage;

charschl[20];

charsb[20];

intteaYear;

intaa=1;

persons*psn;

//插入人员指针

ff>

tp;

while(tp)

{ff>

ag;

ff>

sx;

switch(tp)

case1:

grd;

schl;

psn=newstudent(ag,nm,sx,grd,schl,e,m,g,average);

b

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

当前位置:首页 > 经管营销 > 人力资源管理

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

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