c++课程设计——美发店管理系统
C++課程設(shè)計(jì)——美發(fā)店管理系統(tǒng)
- 美發(fā)店管理系統(tǒng)
- 功能介紹
- 概要設(shè)計(jì)
- 詳細(xì)設(shè)計(jì)
- 源程序清單
- 報(bào)告下載地址
美發(fā)店管理系統(tǒng)
功能介紹
用戶可以在主頁(yè)面選擇自己的身份(顧客/管理員),或者退出系統(tǒng)。如果選擇顧客,則輸入顧客的會(huì)員卡號(hào)進(jìn)入美發(fā)項(xiàng)目菜單頁(yè)面,選擇想要做的美發(fā)項(xiàng)目或者退出系統(tǒng),根據(jù)顧客選擇的美發(fā)項(xiàng)目顯示可以可為其服務(wù)的員工名單,顧客根據(jù)名單選擇為其服務(wù)的員工,選擇成功后,顧客的消費(fèi)額對(duì)應(yīng)增加,員工的收入對(duì)應(yīng)增加。如果選擇管理員,則需要輸入管理員密碼確認(rèn)身份,共有3次輸入密碼的機(jī)會(huì),確認(rèn)身份后,進(jìn)入美發(fā)店信息管理菜單,選擇管理顧客信息或者員工信息或者退出系統(tǒng),如果選擇管理顧客,則進(jìn)入顧客信息管理菜單,可以根據(jù)提示選擇對(duì)顧客信息進(jìn)行增加、刪除、修改、查找和按消費(fèi)金額排序等操作;如果選擇管理員工,則進(jìn)入員工信息管理菜單,可以根據(jù)提示對(duì)員工信息進(jìn)行增加、刪除、修改、查找和按收入排序等操作。
概要設(shè)計(jì)
美發(fā)店管理系統(tǒng)涉及顧客、員工、美發(fā)、管理四個(gè)對(duì)象,面向顧客和管理員兩種角色,顧客具有選擇美發(fā)項(xiàng)目、選擇服務(wù)的員工等功能,管理員具有添加、查詢、顯示、編輯、刪除、保存、讀取顧客和員工信息的功能,還具有根據(jù)顧客的消費(fèi)額、員工的收入進(jìn)行排序的功能。
詳細(xì)設(shè)計(jì)
定義存放顧客信息的結(jié)點(diǎn)
//定義存放顧客信息的結(jié)點(diǎn) typedef struct CustomerNode //定義存放顧客信息的結(jié)構(gòu)體 {int Number; //會(huì)員卡號(hào)string Name; //姓名string Sex; //性別string PhoneNumber; //電話號(hào)碼int Consumption; //消費(fèi)額struct CustomerNode *next; //指針域 }CustomerNode;定義存放員工信息的結(jié)點(diǎn)
//定義存放員工信息的結(jié)點(diǎn) typedef struct WorkerNode //定義存放員工信息的結(jié)構(gòu)體 {int Number; //編號(hào)string Name; //姓名string Sex; //性別string PhoneNumber; //電話號(hào)碼string item; //美發(fā)項(xiàng)目struct WorkerNode *next; //指針域int Income; //收入 }WorkerNode;聲明顧客類
//聲明顧客類 class Customer { private:int m; //顧客總?cè)藬?shù) public:CustomerNode *LoadRecordFile(); //從文件中加載顧客信息void Display(CustomerNode *head); //輸出所有顧客的信息void SaveRecordFile(CustomerNode *head); //保存顧客信息到文件CustomerNode *AddCustomer(CustomerNode *head); //增加顧客信息CustomerNode *FindRecordNumber(CustomerNode *head,int a); //查找CustomerNode *DeleteRecord(CustomerNode *head); //刪除顧客信息CustomerNode *UpdateRecord(CustomerNode *head); //修改顧客信息CustomerNode *Count(CustomerNode *head); //統(tǒng)計(jì)并按消費(fèi)額排序 };聲明員工類
//聲明員工類 class Worker { private:int m; //員工總?cè)藬?shù) public:WorkerNode *LoadRecordFile(); //從文件中加載員工信息void Display(WorkerNode *head); //輸出所有員工的信息void SaveRecordFile(WorkerNode *head); //保存員工信息到文件WorkerNode *AddWorker(WorkerNode *head); //增加員工信息WorkerNode *FindRecordNumber(WorkerNode *head,int a); //查找WorkerNode *DeleteRecord(WorkerNode *head); //刪除員工信息WorkerNode *UpdateRecord(WorkerNode *head); //修改員工信息WorkerNode *Count(WorkerNode *head); //統(tǒng)計(jì)并按收入排序 };聲明管理類
//聲明管理類 class Manger { public:Customer c; //定義一個(gè)顧客類對(duì)象Worker w; //定義一個(gè)員工類對(duì)象CustomerNode *h1,*p1; //定義指針變量h1,p1WorkerNode *h2,*p2; //定義指針變量h2,p2void Init(); //將h1,h2賦值為NULLvoid MainMenu(); //管理功能主菜單void CustomerMenu(); //顧客管理菜單void WorkerMenu(); //員工管理菜單 };聲明美發(fā)類
//聲明美發(fā)類 class ItemMenu() { public:Customer cus; //定義一個(gè)顧客類對(duì)象Worker work; //定義一個(gè)員工類對(duì)象CustomerNode *h1,*c1; //定義指針變量h1,c1WorkerNode *h2,*w1; //定義指針變量h2,w1void Init(); //為h1,h2賦值void ItemMenu(); //美發(fā)項(xiàng)目菜單int WorkerShow(string a,int cost); //選擇服務(wù)的員工 };聲明菜單選擇函數(shù)
//聲明菜單選擇函數(shù) void Salonmeun(); //菜單選擇函數(shù)主函數(shù)
//主函數(shù) int main() //主函數(shù) {Salonmeun();return 0; }源程序清單
#include<iostream> #include<fstream> #include<string> using namespace std; typedef struct CustomerNode //定義存放顧客信息的結(jié)構(gòu)體 {int Number; //會(huì)員卡號(hào)string Name; //姓名string Sex; //性別string PhoneNumber; //電話號(hào)碼int Consumption; //消費(fèi)額struct CustomerNode *next; //指針域 }CustomerNode; typedef struct WorkerNode //定義存放員工信息的結(jié)構(gòu)體 {int Number; //編號(hào)string Name; //姓名string Sex; //性別string PhoneNumber; //電話號(hào)碼string item; //美發(fā)項(xiàng)目struct WorkerNode *next; //指針域int Income; //收入 }WorkerNode; class Customer //定義顧客類 { private:int m; //記錄顧客的人數(shù) public:CustomerNode *LoadRecordFile() //從文件中加載顧客信息{m=0;CustomerNode *p1,*p2; CustomerNode *head;head=NULL;ifstream ifile; //定義輸入文件對(duì)象ifile.open("D:\\Customer.txt",ios::in);//以讀的方式打開文件Customer.txtif(!ifile){cout<<"文件不存在,加載不成功!"<<endl;return NULL; //文件打開錯(cuò)誤}char s[50];ifile.getline(s,50); //讀取文件指針當(dāng)前行數(shù)據(jù)while(!ifile.eof()){p1=new CustomerNode; //創(chuàng)建一個(gè)新的結(jié)點(diǎn)m++; //顧客人數(shù)加1ifile>>p1->Number>>p1->Name>>p1->Sex>>p1->PhoneNumber>>p1->Consumption;//將數(shù)據(jù)從文件中讀取到新的結(jié)點(diǎn)中p1->next=NULL; //新結(jié)點(diǎn)的指針域?yàn)榭?/span>if(head==NULL) //將新結(jié)點(diǎn)插入到鏈表中{head=p1;p2=p1;}else{p2->next=p1;p2=p1;}}ifile.close(); //關(guān)閉文件對(duì)象cout<<"加載成功!"<<endl;return head;}void Display(CustomerNode *head) //輸出所有顧客的信息{CustomerNode *p;p=head;cout<<"=============================================="<<endl;if(p==NULL){cout<<"抱歉,沒有任何記錄!"<<endl;}else{while(p){cout<<p->Number<<'\t'<<p->Name<<'\t'<<p->Sex<<'\t'<<p->PhoneNumber<<'\t'<<p->Consumption<<endl;p=p->next;}}cout<<"=============================================="<<endl;}void SaveRecordFile(CustomerNode *head)//保存顧客信息到文件{CustomerNode *ptr;ofstream ofile;//定義輸出文件對(duì)象ofile.open("D:\\Customer.txt",ios::out);//以寫的方式打開文件Customer.txtif(!ofile){cout<<"數(shù)據(jù)文件打開錯(cuò)誤,沒有將數(shù)據(jù)寫入文件!"<<endl;//文件打開錯(cuò)誤return ;}while(head){ofile<<endl<<head->Number<<' '<<head->Name<<' '<<head->Sex<<' '<<head->PhoneNumber<<' '<<head->Consumption;ptr=head;head=head->next;delete ptr;}ofile.close();cout<<"保存成功!"<<endl;}CustomerNode *AddCustomer(CustomerNode *head)//增加顧客信息{CustomerNode *p1,*p2;CustomerNode *ptr1,*p;int flag=1;if(head!=NULL){p2=head;while(p2->next!=NULL) //判斷頭指針是否為空p2=p2->next;}cout<<"請(qǐng)依次輸入會(huì)員的信息!"<<endl;cout<<"會(huì)員卡號(hào) 姓名 性別 電話 消費(fèi)金額"<<endl;cout<<"當(dāng)輸入的姓名為#時(shí),結(jié)束輸入!"<<endl;cout<<"==================================="<<endl;p1=new CustomerNode;cin>>p1->Number>>p1->Name>>p1->Sex>>p1->PhoneNumber>>p1->Consumption;p1->next=NULL;while(p1->Name!="#") //顧客的名字為‘#’結(jié)束增加顧客{flag=1;ptr1=head;if(head==NULL){head=p1;p2=p1;}else{while(ptr1!=NULL){if(ptr1->Number==p1->Number){cout<<"添加的顧客的會(huì)員卡號(hào)已存在!請(qǐng)重新添加顧客信息!"<<endl;flag=0;break;} //判斷添加的顧客的會(huì)員卡號(hào)是否唯一ptr1=ptr1->next;}if(flag){p2->next=p1;p2=p1;m++;}else{delete p1;}}cout<<"會(huì)員卡號(hào) 姓名 性別 電話 消費(fèi)金額"<<endl;p1= new CustomerNode;cin>>p1->Number>>p1->Name>>p1->Sex>>p1->PhoneNumber>>p1->Consumption;p1->next=NULL;}delete p1;cout<<"==================================="<<endl;return head;}CustomerNode *FindRecordNumber(CustomerNode *head,int a)//根據(jù)卡號(hào)查找顧客{CustomerNode *p1;p1=head;if(head==NULL){return p1;}while(head!=NULL&&p1!=NULL){if(p1->Number==a){break;}p1=p1->next;}return p1;}CustomerNode *DeleteRecord(CustomerNode *head)//刪除顧客信息{CustomerNode *p1,*p2;int num;cout<<"==================================="<<endl;if(head==NULL){cout<<"抱歉,沒有任何記錄!"<<endl;return head;}cout<<"請(qǐng)輸入想要?jiǎng)h除的顧客的會(huì)員卡號(hào)!"<<endl;cin>>num;p1=p2=head;while(p1!=NULL&&p1->Number!=num){p2=p1;p1=p1->next;}if(p1!=NULL){if(p1==head)head=head->next;elsep2->next=p1->next;m--;delete p1;cout<<"刪除成功!"<<endl;}else{cout<<"抱歉,沒有該顧客的信息!"<<endl;}cout<<"==================================="<<endl;return head;}CustomerNode *UpdateRecord(CustomerNode *head)//修改顧客信息{CustomerNode *p1,*p2,*ptr;int num;int flag=1;int c;ptr=new CustomerNode;cout<<"==================================="<<endl;if(head==NULL){cout<<"抱歉,沒有任何記錄!"<<endl;return head;}cout<<"請(qǐng)輸入想要修改的顧客的會(huì)員卡號(hào)!"<<endl;cin>>num;p1=p2=head;while(p1!=NULL&&p1->Number!=num)p1=p1->next;if(p1!=NULL){cout<<"是否要修改會(huì)員卡號(hào)!(1是2否)"<<endl;cin>>c;if(c==1){cout<<"請(qǐng)輸入修改后的顧客信息!"<<endl;cout<<"會(huì)員卡號(hào) 姓名 性別 電話 消費(fèi)金額"<<endl;cin>>ptr->Number>>ptr->Name>>ptr->Sex>>ptr->PhoneNumber>>ptr->Consumption;while(p2!=NULL){if(p2->Number==ptr->Number)//判斷修改后的會(huì)員卡號(hào)是否唯一 {cout<<"添加的顧客的會(huì)員卡號(hào)已存在!"<<endl;flag=0;break;}p2=p2->next;}if(flag){p1->Number=ptr->Number;p1->Name=ptr->Name;p1->Sex=ptr->Sex; p1->PhoneNumber=p1->PhoneNumber;p1->Consumption=ptr->Consumption;cout<<"修改成功!"<<endl;}elsecout<<"修改失敗!"<<endl;delete ptr;}else{cout<<"請(qǐng)輸入修改后的顧客信息!"<<endl;cout<<"姓名 性別 電話 消費(fèi)金額"<<endl;cin>>p1->Name>>p1->Sex>>p1->PhoneNumber>>p1->Consumption;cout<<"修改成功!"<<endl;}}elsecout<<"修改失敗!"<<endl;cout<<"==================================="<<endl;return head;}CustomerNode *Count(CustomerNode *head)//統(tǒng)計(jì)并按消費(fèi)額排序{CustomerNode *ph;ph=head;if(ph==NULL){cout<<"抱歉,沒有任何記錄!"<<endl;return NULL;}if(ph->next==NULL){cout<<ph->Number<<'\t'<<ph->Name<<'\t'<<ph->Sex<<'\t'<<ph->PhoneNumber<<'\t'<<ph->Consumption<<endl;return NULL;}CustomerNode *max_pre,*max,*tmp,*new_list,*tail_sort;max_pre=NULL;max=ph;tmp=ph;new_list=NULL;tail_sort=NULL;while(ph){max=ph;tmp=ph;while(tmp->next){if(max->Consumption<tmp->next->Consumption){max=tmp->next;max_pre=tmp;}tmp=tmp->next;}if(max==ph)ph=ph->next;else{max_pre->next=max->next;max->next=NULL;}if(new_list==NULL){new_list=max;tail_sort=new_list;}else{tail_sort->next=max;tail_sort=max;}}return new_list;} }; class Worker//定義員工類 { private:int m;//記錄結(jié)點(diǎn)的個(gè)數(shù) public:WorkerNode *LoadRecordFile()//從文件中加載員工信息{m=0;WorkerNode *p1,*p2;WorkerNode *head;head=NULL;ifstream ifile; //定義輸入文件對(duì)象ifile.open("D:\\Worker.txt",ios::in);//以讀的方式打開文件Worker.txtif(!ifile){cout<<"文件不存在,加載不成功!"<<endl;return NULL; //文件打開錯(cuò)誤}char s[50];ifile.getline(s,50);while(!ifile.eof()){p1=new WorkerNode;//創(chuàng)建一個(gè)新的結(jié)點(diǎn) m++;ifile>>p1->Number>>p1->Name>>p1->Sex>>p1->PhoneNumber>>p1->item>>p1->Income;//將數(shù)據(jù)從文件中讀取到新的結(jié)點(diǎn)中p1->next=NULL; //新結(jié)點(diǎn)的指針域?yàn)榭?/span>if(head==NULL) //將新結(jié)點(diǎn)插入到鏈表中{head=p1;p2=p1;}else{p2->next=p1;p2=p1;}}ifile.close(); //關(guān)閉文件對(duì)象cout<<"加載成功!"<<endl;return head;}void Display(WorkerNode *head) //輸出所有員工的信息{WorkerNode *p;p=head;cout<<"==========================================================="<<endl;if(p==NULL){cout<<"抱歉,沒有任何記錄!"<<endl;}else{while(p){cout<<p->Number<<'\t'<<p->Name<<'\t'<<p->Sex<<'\t'<<p->PhoneNumber<<'\t'<<p->item<<'\t'<<p->Income<<endl;p=p->next;}}cout<<"==========================================================="<<endl;}void SaveRecordFile(WorkerNode *head)//保存員工信息到文件{WorkerNode *ptr;ofstream ofile;//定義輸出文件對(duì)象ofile.open("D:\\Worker.txt",ios::out);//以寫的方式打開文件Worker.txtif(!ofile){cout<<"數(shù)據(jù)文件打開錯(cuò)誤,沒有將數(shù)據(jù)寫入文件!"<<endl;return ;}while(head){ofile<<endl<<head->Number<<' '<<head->Name<<' '<<head->Sex<<' '<<head->PhoneNumber<<' '<<head->item<<' '<<head->Income;ptr=head;head=head->next;delete ptr;}cout<<"保存成功!"<<endl;ofile.close();}WorkerNode *AddWorker(WorkerNode *head)//增加員工信息{WorkerNode *p1,*p2;WorkerNode *ptr1,*p;int flag=1;if(head!=NULL){p2=head;while(p2->next!=NULL)p2=p2->next;}cout<<"請(qǐng)依次輸入員工的信息!"<<endl;cout<<"編號(hào) 姓名 性別 電話 美發(fā)項(xiàng)目 收入"<<endl;cout<<"當(dāng)輸入的姓名為#時(shí),結(jié)束輸入!"<<endl;cout<<"==================================="<<endl;p1=new WorkerNode;cin>>p1->Number>>p1->Name>>p1->Sex>>p1->PhoneNumber>>p1->item>>p1->Income;p1->next=NULL;while(p1->Name!="#")//當(dāng)姓名為‘#’結(jié)束輸入{flag=1;ptr1=head;if(head==NULL){head=p1;p2=p1;}else{while(ptr1!=NULL){if(ptr1->Number==p1->Number){cout<<"添加的員工的編號(hào)已存在!請(qǐng)重新添加員工信息!"<<endl;flag=0;break;} //判斷添加的員工的編號(hào)是否唯一ptr1=ptr1->next;}if(flag){p2->next=p1;p2=p1;m++;}else{delete p1;}}cout<<"編號(hào) 姓名 性別 電話 美發(fā)項(xiàng)目 收入"<<endl;p1= new WorkerNode;cin>>p1->Number>>p1->Name>>p1->Sex>>p1->PhoneNumber>>p1->item>>p1->Income;p1->next=NULL;}delete p1;cout<<"==================================="<<endl;return head;}WorkerNode *FindRecordNumber(WorkerNode *head,int a)//根據(jù)編號(hào)查找員工{WorkerNode *p1;p1=head;if(head==NULL){return p1;}while(head!=NULL&&p1!=NULL){if(p1->Number==a){break;}p1=p1->next;}return p1;}WorkerNode *DeleteRecord(WorkerNode *head)//刪除員工信息{WorkerNode *p1,*p2;int num;cout<<"==================================="<<endl;if(head==NULL){cout<<"抱歉,沒有任何記錄!"<<endl;return head;}cout<<"請(qǐng)輸入想要?jiǎng)h除的員工的編號(hào)!"<<endl;cin>>num;p1=p2=head;while(p1!=NULL&&p1->Number!=num){p2=p1;p1=p1->next;}if(p1!=NULL){if(p1==head)head=head->next;elsep2->next=p1->next;m--;delete p1;cout<<"刪除成功!"<<endl;}else{cout<<"抱歉,沒有該員工的信息!"<<endl;}cout<<"==================================="<<endl;return head;}WorkerNode *UpdateRecord(WorkerNode *head)//修改員工信息{WorkerNode *p1,*p2,*ptr;int num;int flag=1;int c;ptr=new WorkerNode;cout<<"==================================="<<endl;if(head==NULL){cout<<"抱歉,沒有任何記錄!"<<endl;return head;}cout<<"請(qǐng)輸入想要修改的員工的編號(hào)!"<<endl;cin>>num;p1=p2=head;while(p1!=NULL&&p1->Number!=num)p1=p1->next;if(p1!=NULL){cout<<"是否要修改員工的編號(hào)!(1是2否)"<<endl;cin>>c;if(c==1){cout<<"請(qǐng)輸入修改后的員工信息!"<<endl;cout<<"編號(hào) 姓名 性別 電話 美發(fā)項(xiàng)目 收入"<<endl;cin>>ptr->Number>>ptr->Name>>ptr->Sex>>ptr->PhoneNumber>>ptr->item>>ptr->Income;;while(p2!=NULL){if(p2->Number==ptr->Number){cout<<"添加的員工的編號(hào)已存在!"<<endl;flag=0;break;} //判斷修改后的員工信息的編號(hào)是否唯一p2=p2->next;}if(flag){p1->Number=ptr->Number;p1->Name=ptr->Name;p1->Sex=ptr->Sex; p1->PhoneNumber=ptr->PhoneNumber;p1->item=ptr->item;p1->Income=ptr->Income;cout<<"修改成功!"<<endl;}elsecout<<"修改失敗!"<<endl;delete ptr;}else{cout<<"請(qǐng)輸入修改后的員工信息!"<<endl;cout<<"姓名 性別 電話 美發(fā)項(xiàng)目 收入"<<endl;cin>>p1->Name>>p1->Sex>>p1->PhoneNumber>>p1->item>>p1->Income;cout<<"修改成功!"<<endl;}}elsecout<<"修改失敗!"<<endl;cout<<"==================================="<<endl;return head;}WorkerNode *Count(WorkerNode *head)//統(tǒng)計(jì)并按收入排序{WorkerNode *ph;ph=head;if(ph==NULL){cout<<"抱歉,沒有任何記錄!"<<endl;return NULL;}if(ph->next==NULL){cout<<ph->Number<<'\t'<<ph->Name<<'\t'<<ph->Sex<<'\t'<<ph->PhoneNumber<<'\t'<<ph->item<<'\t'<<ph->Income;return NULL;}WorkerNode *max_pre,*max,*tmp,*new_list,*tail_sort;max_pre=NULL;max=ph;tmp=ph;new_list=NULL;tail_sort=NULL;while(ph){max=ph;tmp=ph;while(tmp->next){if(max->Income<tmp->next->Income){max=tmp->next;max_pre=tmp;}tmp=tmp->next;}if(max==ph)ph=ph->next;else{max_pre->next=max->next;max->next=NULL;}if(new_list==NULL){tail_sort=max;new_list=tail_sort;}else{tail_sort->next=max;tail_sort=max;}}return new_list;} }; class Manger { public:Customer c; //定義一個(gè)顧客類對(duì)象Worker w; //定義一個(gè)員工類對(duì)象CustomerNode *h1,*p1; //定義指針變量h1,p1WorkerNode *h2,*p2; //定義指針變量h2,p2void Init() //將h1,h2賦值為NULL{h1=NULL;h2=NULL;MainMenu();}void MainMenu() //管理功能主菜單{int c1;cout<<" **************************"<<endl;cout<<" *** 美發(fā)店管理系統(tǒng) ***"<<endl;cout<<" **************************"<<endl;cout<<"**************************美發(fā)店管理功能菜單***************************"<<endl;cout<<" ----------------------------------------------------------"<<endl;cout<<" -- 1.顧客 2.員工 --"<<endl;cout<<" -- 3.退出系統(tǒng) --"<<endl;cout<<" -- 選擇選項(xiàng)后,按回車確認(rèn) --"<<endl;cout<<" ----------------------------------------------------------"<<endl;cout<<"***********************************************************************"<<endl;cin>>c1;system("cls");switch(c1){case 1:{CustomerMenu();break;}case 2:{WorkerMenu();break;}case 3:{break;}}}void CustomerMenu() 顧客管理菜單{int choice1;cout<<"**************************顧客信息管理菜單******************************"<<endl;cout<<" ----------------------------------------------------------"<<endl;cout<<" -- 1.讀取顧客信息 2.保存顧客信息 --"<<endl;cout<<" -- 3.顯示所有顧客信息 4.查找顧客信息 --"<<endl;cout<<" -- 5.添加顧客信息 6.編輯顧客信息 --"<<endl;cout<<" -- 7.刪除顧客信息 8.統(tǒng)計(jì)顧客消費(fèi)額 --"<<endl;cout<<" -- 9.返回 --"<<endl;cout<<" -- 選擇選項(xiàng)后,按回車確認(rèn) --"<<endl;cout<<" ----------------------------------------------------------"<<endl;cout<<"***********************************************************************"<<endl;cin>>choice1;system("cls");switch(choice1){case 1:{h1=c.LoadRecordFile();CustomerMenu();break;}case 2:{c.SaveRecordFile(h1);CustomerMenu();break;}case 3:{c.Display(h1);CustomerMenu();break;}case 4:{p1=NULL;int nb;cout<<"請(qǐng)輸入要查詢的顧客的會(huì)員卡號(hào)!"<<endl;cin>>nb;p1=c.FindRecordNumber(h1,nb);if(p1!=NULL){cout<<"會(huì)員卡號(hào):"<<p1->Number<<'\t'<<"姓名:"<<p1->Name<<'\t'<<"性別:"<<p1->Sex<<'\t'<<"電話:"<<p1->PhoneNumber<<'\t'<<"消費(fèi)金額:"<<p1->Consumption<<endl;}elsecout<<"沒有找到對(duì)應(yīng)的顧客!"<<endl;CustomerMenu();break;}case 5:{h1=c.AddCustomer(h1);CustomerMenu();break;}case 6:{h1=c.UpdateRecord(h1);CustomerMenu();break;}case 7:{h1=c.DeleteRecord(h1);CustomerMenu();break;}case 8:{CustomerNode *hh;hh=c.Count(h1);while(hh!=NULL){cout<<hh->Number<<'\t'<<hh->Name<<'\t'<<hh->Sex<<'\t'<<hh->PhoneNumber<<'\t'<<hh->Consumption<<endl;hh=hh->next;}CustomerMenu();break;}case 9:{MainMenu();break;}default:{cout<<"ERROR!"<<endl;CustomerMenu();break;}}}void WorkerMenu() //員工管理菜單{int choice1;cout<<"**************************員工信息管理菜單******************************"<<endl;cout<<" ----------------------------------------------------------"<<endl;cout<<" -- 1.讀取員工信息 2.保存員工信息 --"<<endl;cout<<" -- 3.顯示所有員工信息 4.查找員工信息 --"<<endl;cout<<" -- 5.添加員工信息 6.編輯員工信息 --"<<endl;cout<<" -- 7.刪除員工信息 8.統(tǒng)計(jì)員工收入額 --"<<endl;cout<<" -- 9.返回 --"<<endl;cout<<" -- 選擇選項(xiàng)后,按回車確認(rèn) --"<<endl;cout<<" ----------------------------------------------------------"<<endl;cout<<"***********************************************************************"<<endl;cin>>choice1;system("cls");switch(choice1){case 1:{h2=w.LoadRecordFile();WorkerMenu();break;}case 2:{w.SaveRecordFile(h2);WorkerMenu();break;}case 3:{w.Display(h2);WorkerMenu();break;}case 4:{p2=NULL;int nb;cout<<"請(qǐng)輸入要查詢的員工的編號(hào)!"<<endl;cin>>nb;p2=w.FindRecordNumber(h2,nb);if(p2!=NULL){cout<<"編號(hào):"<<p2->Number<<'\t'<<"姓名:"<<p2->Name<<'\t'<<"性別:"<<p2->Sex<<'\t'<<"電話:"<<p2->PhoneNumber<<'\t'<<"美發(fā)項(xiàng)目:"<<p2->item<<'\t'<<"收入:"<<p2->Income<<endl;}elsecout<<"沒有找到對(duì)應(yīng)的員工!"<<endl;WorkerMenu();break;}case 5:{h2=w.AddWorker(h2);WorkerMenu();break;}case 6:{h2=w.UpdateRecord(h2);WorkerMenu();break;}case 7:{h2=w.DeleteRecord(h2);WorkerMenu();break;}case 8:{WorkerNode *pp;pp=w.Count(h2);while(pp!=NULL){cout<<pp->Number<<'\t'<<pp->Name<<'\t'<<pp->Sex<<'\t'<<pp->PhoneNumber<<'\t'<<pp->item<<'\t'<<pp->Income<<endl;pp=pp->next;}WorkerMenu();break;}case 9:{MainMenu();break;}default:{cout<<"ERROR!"<<endl;WorkerMenu();break;}}} }; class Item { public:Customer cus; //定義一個(gè)顧客類對(duì)象Worker work; //定義一個(gè)員工類對(duì)象CustomerNode *h1,*c1; //定義指針變量h1,c1WorkerNode *h2,*w1; //定義指針變量h2,w1void Init() //為h1,h2賦值{h1=NULL;h2=NULL;h1=cus.LoadRecordFile();h2=work.LoadRecordFile();ItemMenu();}void ItemMenu() //美發(fā)項(xiàng)目菜單{int choice1;int num;int cost;int res;string pro;cout<<"請(qǐng)輸入您的會(huì)員卡號(hào)!"<<endl;cin>>num;c1=cus.FindRecordNumber(h1,num);if(c1==NULL){cout<<"抱歉,沒有此會(huì)員卡號(hào)的顧客信息!"<<endl;ItemMenu();return ;}else{cout<<c1->Number<<'\t'<<c1->Name<<endl;}cout<<"****************************美發(fā)項(xiàng)目菜單******************************"<<endl;cout<<" ----------------------------------------------------------"<<endl;cout<<" -- 1.洗發(fā) 15元 2.理發(fā) 25元 --"<<endl;cout<<" -- 3.燙發(fā) 300元 4.染發(fā) 500元 --"<<endl;cout<<" -- 5.退出系統(tǒng) --"<<endl;cout<<" -- 選擇選項(xiàng)后,按回車確認(rèn) --"<<endl;cout<<" ----------------------------------------------------------"<<endl;cout<<"***********************************************************************"<<endl;cin>>choice1;system("cls");switch(choice1){case 1:{pro="洗發(fā)";cost=15;res=WorkerShow(pro,cost);if(res==1){c1->Consumption=c1->Consumption+cost;cout<<"謝謝惠顧!"<<endl;cus.SaveRecordFile(h1);work.SaveRecordFile(h2);}break;}case 2:{pro="理發(fā)";cost=25;res=WorkerShow(pro,cost);if(res==1){c1->Consumption=c1->Consumption+cost;cout<<"謝謝惠顧!"<<endl;cus.SaveRecordFile(h1);work.SaveRecordFile(h2);}break;}case 3:{pro="燙發(fā)";cost=300;res=WorkerShow(pro,cost);if(res==1){c1->Consumption=c1->Consumption+cost;cout<<"謝謝惠顧!"<<endl;cus.SaveRecordFile(h1);work.SaveRecordFile(h2);}break;}case 4:{pro="染發(fā)";cost=500;res=WorkerShow(pro,cost);if(res==1){c1->Consumption=c1->Consumption+cost;cout<<"謝謝惠顧!"<<endl;cus.SaveRecordFile(h1);work.SaveRecordFile(h2);}break;}case 5:{break;}default:{cout<<"ERROR!"<<endl;ItemMenu();break;}}}int WorkerShow(string a,int cost) //選擇服務(wù)的員工{w1=NULL;int cc;WorkerNode *p;p=h2;if(p==NULL){cout<<"抱歉,沒有任何記錄!"<<endl;return 0;}cout<<"以下員工可為您服務(wù):"<<endl;while(p!=NULL){if(p->item==a)cout<<p->Number<<'\t'<<p->Name<<'\t'<<p->Sex<<endl;p=p->next;}cout<<"請(qǐng)輸入員工編號(hào)選擇為您服務(wù)的員工!"<<endl;cin>>cc;w1=work.FindRecordNumber(h2,cc);if(w1!=NULL){cout<<w1->Number<<'\t'<<w1->Name<<endl;w1->Income=w1->Income+cost;return 1;}else{cout<<"沒有輸入正確的可為您服務(wù)的員工編號(hào)!"<<endl;cout<<"選擇服務(wù)失敗!"<<endl;return 2;} } }; void Salonmeun() //菜單選擇函數(shù) {Manger m;Item it;int cc;cout<<" **************************"<<endl;cout<<" *** 美發(fā)店管理系統(tǒng) ***"<<endl;cout<<" **************************"<<endl;cout<<"*****************************請(qǐng)選擇您的身份****************************"<<endl;cout<<" ----------------------------------------------------------"<<endl;cout<<" -- 1.顧客 2.管理員 --"<<endl;cout<<" -- 3.退出系統(tǒng) --"<<endl;cout<<" -- 選擇選項(xiàng)后,按回車確認(rèn) --"<<endl;cout<<" ----------------------------------------------------------"<<endl;cout<<"***********************************************************************"<<endl;cin>>cc;system("cls");switch(cc){case 1:{it.Init();break;}case 2:{int password;int flag=0;cout<<"****************************************"<<endl;cout<<"請(qǐng)輸入管理員密碼!(提示:4位密碼)(共3次機(jī)會(huì))"<<endl;for(int i=1;i<=3;i++){cin>>password;if(password!=6666){cout<<"密碼錯(cuò)誤!"<<endl;continue;}else{cout<<"密碼正確!"<<endl;cout<<"****************************************"<<endl;flag=1;break;}}if(flag==0){cout<<"正在退出管理系統(tǒng)!"<<endl;cout<<"****************************************"<<endl;}if(flag==1){m.Init();}break;}case 3:{cout<<"正在退出管理系統(tǒng)!"<<endl;cout<<"****************************************"<<endl;break;}default:{Salonmeun();break;}} } int main() //主函數(shù) {Salonmeun();return 0; }報(bào)告下載地址
課程設(shè)計(jì)報(bào)告+代碼+測(cè)試文件
下載地址:https://download.csdn.net/download/gouyinghong/20087440
總結(jié)
以上是生活随笔為你收集整理的c++课程设计——美发店管理系统的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 使用LM2575代替7805
- 下一篇: cv2 interpolate插值-al