2016 年 12 月
目 录
一 成员分工...................................................................................................................................................................1
二 需求分析...................................................................................................................................................................2
1.系统概述............................................................. ........2
2.系统运行环境................................................................2
3.功能需求描述................................................................2
三 总体设计...................................................................................................................................................................3
1.屏幕的组成....................................... ............. ..............3
2.主菜单的组成................................................................3
3.子菜单的功能................................................................3
所有主菜单都有显示信息,增加信息,删除信息,保存信息,返回....................................................................3
四 详细设计...................................................................................................................................................................4
1.程序流程图...............................................................................................................................................................4
(
1
)数据流图
......................................................................................................................................................4
2 程序模块详细设计................... ............. ............. ............. ..5
(
1
)主菜单的设计
..............................................................................................................................................6
(
2
)顾客管理功能的设计
..................................................................................................................................7
void customermenu(Customer::node*list,Customer m).......................................................................................11
{.............................................................................................................................................................................11
int choose;............................................................................................................................................................11
cout<<endl<<endl..............................................................................................................................................11
<<" **************************"<<endl...................................................................................................11
<<" ***
美发店管理系统
***"<<endl.............................................................................................................11
<<" **************************"<<endl...................................................................................................11
<<"
文档将保存在
d
盘
"<<endl;.....................................................................................................................12
cout<<"**********************vip
理功能菜单
**********************"<<endl//
功能表
.................12
<<" ----------------------------------------------------------"<<endl..........................................................................12
<<" -- 1.
显示所有
VIP
信息
2.
增加
VIP
信息
--"<<endl.................................................................................12
<<" -- 3.
删除
VIP
信息
4.
保存
--"<<endl.........................................................................................................12
<<" -- 5.
返回
--"<<endl.....................................................................................................................................12
<<" --
选择选项后,按回车确认
--"<<endl....................................................................................................12
<<" ----------------------------------------------------------"<<endl <<endl;...........................................................12
cin>>choose;......................................................................................................................................................12
switch(choose).....................................................................................................................................................12
{............................................................................................................................................................................12
case 1: m.print(list);break;..................................................................................................................................12
case 2:m.creat(list);break;...................................................................................................................................12
case 3: m.Delete(list);break;...............................................................................................................................12
case 4: m.WriteData(list);break;.........................................................................................................................12
case 5:itemmenu();break;....................................................................................................................................12
default:cout<<"error"<<endl;customermenu(list,m);break;.............................................................................12
}............................................................................................................................................................................12
customermenu(list,m);.........................................................................................................................................12
}.............................................................................................................................................................................12
(
3
)员工管理功能的设计
................................................................................................................................12
class Worker..........................................................................................................................................................12
{.............................................................................................................................................................................12
private:..................................................................................................................................................................12
int m ;...................................................................................................................................................................12
public :..................................................................................................................................................................12
typedef struct node...............................................................................................................................................12
{............................................................................................................................................................................12
int Number;..........................................................................................................................................................12
char Name[10];...................................................................................................................................................12
char Sex[4];.........................................................................................................................................................12
char PhoneNumber[11];......................................................................................................................................13
node *next;..........................................................................................................................................................13
}node,*linklist;.....................................................................................................................................................13
node *p1,*p2;......................................................................................................................................................13
node* ReadData()................................................................................................................................................13
{............................................................................................................................................................................13
m= 0;...................................................................................................................................................................13
node *head;.........................................................................................................................................................13
FILE *fp;.............................................................................................................................................................13
if((fp=fopen("d:\\Worker.txt","r"))==0)..............................................................................................................13
{............................................................................................................................................................................13
cout<<"
没有员工
,
请输入信息
"<<endl;...........................................................................................................13
cout<<"
请输入信息:
(
美发编号为
0
时结束
)
,输入完毕请保存
"<<endl...................................................13
<<"
编号 姓名 性别 电话
"<<endl...................................................................................................................13
<<"**********************************************************\n";............................................13
p1=p2=new node;...............................................................................................................................................13
cin>>p1->Number>>p1->Name>>p1->Sex>>p1->PhoneNumber;..............................................................13
while(p1 -> Number != 0 )..................................................................................................................................13
{............................................................................................................................................................................13
m++;....................................................................................................................................................................13
if(m == 1)............................................................................................................................................................13
head = p1;...........................................................................................................................................................13
else.......................................................................................................................................................................13
p2 -> next = p1;..................................................................................................................................................13
p2 = p1;...............................................................................................................................................................13
p1 = new node;....................................................................................................................................................13
cin>>p1->Number>>p1->Name>>p1->Sex>>p1->PhoneNumber;..............................................................13
}............................................................................................................................................................................13
p2 -> next = NULL;............................................................................................................................................13
return head;.........................................................................................................................................................13
}............................................................................................................................................................................13
p1=p2=new node;...............................................................................................................................................13
head = NULL;.....................................................................................................................................................13
while (!feof(fp))....................................................................................................................................................13
{............................................................................................................................................................................13
m++;....................................................................................................................................................................13
fscanf(fp,"%d %s %s %s\n",&p1->Number,&p1->Name,&p1->Sex,&p1->PhoneNumber);...........................14
if(m == 1)............................................................................................................................................................14
head = p1;...........................................................................................................................................................14
else.......................................................................................................................................................................14
p2 -> next = p1;..................................................................................................................................................14
p2 = p1;...............................................................................................................................................................14
p1 = new node;....................................................................................................................................................14
}............................................................................................................................................................................14
p2 -> next = NULL;............................................................................................................................................14
fclose(fp);.............................................................................................................................................................14
- -
1
return head;.........................................................................................................................................................14
}............................................................................................................................................................................14
void creat(node *head)........................................................................................................................................14
{............................................................................................................................................................................14
cout<<"
请输入信息:
(
美发编号为
0
时结束
)
,输入完毕请保存
"<<endl...................................................14
<<"
编号 姓名 性别 电话
"<<endl.....................................................................................................................14
<<"**********************************************************\n";............................................14
cin>>p1->Number>>p1->Name>>p1->Sex>>p1->PhoneNumber;..............................................................14
while(p1 -> Number != 0 )..................................................................................................................................14
{............................................................................................................................................................................14
m = m+1;.............................................................................................................................................................14
if(m == 1)............................................................................................................................................................14
head = p1;...........................................................................................................................................................14
else.......................................................................................................................................................................14
p2 -> next = p1;..................................................................................................................................................14
p2 = p1;...............................................................................................................................................................14
p1 = new node;....................................................................................................................................................14
cin>>p1->Number>>p1->Name>>p1->Sex>>p1->PhoneNumber;..............................................................14
}............................................................................................................................................................................14
p2 -> next = NULL;............................................................................................................................................14
}............................................................................................................................................................................14
int print(node*H).................................................................................................................................................14
{............................................................................................................................................................................14
cout<<"
编号 姓名 性别 电话
"<<endl..............................................................................................................14
<<"**********************************************************\n";............................................14
if(m == 0)............................................................................................................................................................15
{cout<<"
没有员工
"<<endl;return 0;}...............................................................................................................15
struct node *p;.....................................................................................................................................................15
p = H ;.................................................................................................................................................................15
while(p!=NULL)..................................................................................................................................................15
{............................................................................................................................................................................15
cout<<p->Number<<"\t"<<p->Name<<"\t"<<p->Sex<<"\t"<<p->PhoneNumber<<endl;.......................15
p=p->next;..........................................................................................................................................................15
}............................................................................................................................................................................15
system("PAUSE");...............................................................................................................................................15
}............................................................................................................................................................................15
int Delete(node *Head).......................................................................................................................................15
{............................................................................................................................................................................15
int num;................................................................................................................................................................15
cout<<"
请输入要删除的员工:输入完毕请保存
"<<endl;............................................................................15
cin>>num;...........................................................................................................................................................15
node *p3,*p4,*tem;.............................................................................................................................................15
p3 = Head;..........................................................................................................................................................15
if(p3 ->Number == num)....................................................................................................................................15
{tem=Head; Head=tem ->next;return 0;}..........................................................................................................15
p4 = p3;...............................................................................................................................................................15
p3 = p3->next;....................................................................................................................................................15
while(p3!=NULL)................................................................................................................................................15
{............................................................................................................................................................................15
if(p3->Number == num).....................................................................................................................................15
{p4->next = p3 ->next;return 0;}.......................................................................................................................15
//...........................................................................................................................................................................15
p4 = p3;...............................................................................................................................................................15
p3 = p3 ->next;...................................................................................................................................................15
}............................................................................................................................................................................15
}.............................................................................................................................................................................15
int WriteData(node *head)..................................................................................................................................15
{............................................................................................................................................................................15
- -
2
FILE *fp;.............................................................................................................................................................15
node *p;...............................................................................................................................................................15
if((fp=fopen("d:\\Worker.txt","w"))==NULL).....................................................................................................15
{............................................................................................................................................................................16
printf("
打开文件出错
\n");..................................................................................................................................16
return 0;...............................................................................................................................................................16
}............................................................................................................................................................................16
p=head;...............................................................................................................................................................16
while(p!=NULL)..................................................................................................................................................16
{............................................................................................................................................................................16
fprintf(fp,"%d %s %s %s\n",p->Number,p->Name,p->Sex,p->PhoneNumber);...............................................16
p=p->next;..........................................................................................................................................................16
}............................................................................................................................................................................16
fprintf(fp,"\0");.....................................................................................................................................................16
rewind(fp);...........................................................................................................................................................16
fclose(fp);//
关闭文件
...........................................................................................................................................16
}............................................................................................................................................................................16
};...........................................................................................................................................................................16
void workermenu(Worker::node*list,Worker m)..................................................................................................16
{.............................................................................................................................................................................16
int choose;............................................................................................................................................................16
cout<<endl<<endl..............................................................................................................................................16
<<" **************************"<<endl...................................................................................................16
<<" ***
美发店管理系统
***"<<endl.............................................................................................................16
<<" **************************"<<endl...................................................................................................16
<<"
文档将保存在
d
盘
"<<endl;.....................................................................................................................16
cout<<"*********************
员工管理功能菜单
*******************"<<endl//
功能表
...................16
<<" ----------------------------------------------------------"<<endl..........................................................................16
<<" -- 1.
显示所有员工信息
2.
增加员工信息
--"<<endl................................................................................16
<<" -- 3.
删除员工信息
4.
保存
--"<<endl........................................................................................................16
<<" -- 5.
返回
--"<<endl.....................................................................................................................................16
<<" --
选择选项后,按回车确认
--"<<endl....................................................................................................16
<<" -------------------------------------------------"<<endl<<endl <<endl;...........................................................16
cin>>choose;......................................................................................................................................................16
switch(choose).....................................................................................................................................................16
{............................................................................................................................................................................17
case 1: m.print(list);break;..................................................................................................................................17
case 2:m.creat(list);break;...................................................................................................................................17
case 3: m.Delete(list);break;...............................................................................................................................17
case 4: m.WriteData(list);break;.........................................................................................................................17
case 5:itemmenu();break;....................................................................................................................................17
default:cout<<"error"<<endl;workermenu(list,m);break;................................................................................17
}............................................................................................................................................................................17
workermenu(list,m);............................................................................................................................................17
}.............................................................................................................................................................................17
void worker()........................................................................................................................................................17
{.............................................................................................................................................................................17
Worker m;............................................................................................................................................................17
Worker::node*list2;.............................................................................................................................................17
list2=m.ReadData();...........................................................................................................................................17
workermenu(list2,m);..........................................................................................................................................17
}.............................................................................................................................................................................17
(
4
)管理消费信息功能模块
............................................................................................................................17
class Manage........................................................................................................................................................17
{.............................................................................................................................................................................17
private:..................................................................................................................................................................17
int m;....................................................................................................................................................................17
- -
3