已阅读5页,还剩15页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
#ifndef VIDEO_H#define VIDEO_H#include#includeusing namespace std;/class videostring vidname;class video /影碟类 friend ostream &operator(ostream &os,video &vi);friend class application;public:video(string=,string=,int=0,string=,string=,string=,int=0);video(video &vi);void input();/private:string Vname; /碟片名称string Country; /国家int Type; /类型string Producer; /制片人string Director; /导演string Star; /主演明星int Number; /库存量video *next;video:video(string vname,string country,int type,string producer,string director,string star,int number)Vname=vname;Country=country;Type=type;Producer=producer;Director=director;Star=star;Number=number;video:video(video &vi)Vname=vi.Vname;Country=vi.Country;Type=vi.Type;Producer=vi.Producer;Director=vi.Director;Star=vi.Star;Number=vi.Number;ostream &operator(ostream &os,video *vi)os*endl;os该影碟信息为:endl;os名称:Vname国家:CountryType=1)osType=2)osType=3)osType=4)osType=5)osType=6)os其他;osendl;os制片人:Producer导演:Director主演:Star库存量:Numberendl;return os;#endif#ifndef CUSTOMER_H#define CUSTOMER_H#include#include#includevideo.husing namespace std;/class Customerstruct VideoInfo/碟片信息string VideoName;/影片名称int BeginTime;/影片借阅日期int EndTime;/影片归还日期;string Cname;class Customer /顾客类friend ostream & operator (ostream &os,const Customer &cu);friend class application;friend class video;public:Customer(string=,string=,int=0,int=0,string=,int=0,int=0); /构造函数int DeclineMoney(int );/扣取消费额bool RentVideo(string );/出租影碟bool ReturnVideo(string );/归还影片/private:string idPerson; /会员账号string Name;/会员姓名int LeftMoney;/会员剩余金额int nCount;/所借碟片数量VideoInfo Video10;/每个会员最多借10张影碟Customer *next1;Customer:Customer(string idperson,string name,int leftmoney,int ncount,string videoname,int begintime,int endtime)idPerson=idperson;Name=name;LeftMoney=leftmoney;nCount=ncount;for(int i=0;inCount;i+)Videoi.VideoName=videoname;Videoi.BeginTime=begintime;Videoi.EndTime=endtime;ostream & operator (ostream &os,const Customer *cu)os会员编号为:tidPerson会员姓名为:tName会员剩余会费余额为:tLeftMoneyendl;for (int i=0;inCount;i+)os所借影片名为:tVideoi.VideoNameendl;os影片借阅日期为:tVideoi.BeginTimeendl;os影片归还日期为:tVideoi.EndTimeendl;os-n;return os;#endif#ifndef MENU_H#define MENU_H#includeusing namespace std;/class menuclass menu /菜单类public:int showMainMenu();private:;int menu:showMainMenu()system(cls);cout endl;cout| 欢迎使用影碟出租系统 |endl;cout|*|endl;cout| 1.影碟租赁 |endl;cout| 2.影碟归还 |endl;cout| 3.查看各类型影碟信息 |endl;cout| 4.查询碟片信息 |endl;cout| 5.添加新影碟 |endl; cout| 6.删除碟片信息 |endl; cout| 7.修改碟片信息 |endl;cout| 8.查看会员信息 |endl;cout| 9.注册会员 |endl; cout| 10.注销会员 |endl;cout| 11.更新会员信息与充值 |endl;cout| 12.退出系统 |endl;cout endl;cout请选择1-12:select;while(select12)cout选择错误,请重新选择1-12select;return select;#endif#ifndef APPLICATION_H#define APPLICATION_H#include#include#include#includevideo.h#includeCustomer.h#includemenu.husing namespace std;class application /数据应用类public:application();application();void load(); /数据输出void save(); /数据保存到文件void Rent(); /1.影碟租赁void Return(); /2.影碟归还void Checkall(); /3.查看各类型影碟信息void search(int Type); /根据类型查找void Check(string vidname); /4.查看影碟信息:根据碟片名称查找void Addvideo(); /5.添加影碟void Deletevideo(); /6.删除影碟void Modifyvideo(string Vname); /7.修改影碟信息void Customerinfo(string Cname);/8.会员信息:根据姓名查找void Add(); /9.注册会员void Delete(); /10.注销会员void Modify(string Name); /11.更新会员信息与充值void run();private:string title;menu myMenu;video myvideo;Customer mycustomer;video *vid;Customer *cus;application:application()vid=0;cus=0;load();application:application()video *v; v=vid; Customer *c;c=cus;while(v) v=v-next; delete vid; vid=v; vid=0; while(c) c=c-next1; delete cus; cus=c; vid=0; void application:load()ifstream file; /碟片信息video *v=vid; string Vname; /碟片名称string Country; /国家int Type; /类型string Producer; /制片人string Director; /导演string Star; /主演明星int Number=0; /库存量 file.open(video.txt,ios:in); fileVnameCountryTypeProducerDirectorStarNumber;while(file.good()v=new video(Vname,Country,Type,Producer,Director,Star,Number);v-next=0; /碟片结点加入链表 if(vid) /若已经存在结点 video *v2; v2=vid; while(v2-next) /查找尾结点 v2=v2-next; v2-next=v; /连接 else /若不存在结点(表空) vid=v; /连接 fileVnameCountryTypeProducerDirectorStarNumber;file.close(); ifstream file1; /会员信息Customer *c=cus;string idPerson; /会员账号string Name;/会员姓名int LeftMoney;/会员剩余金额int nCount;/所借碟片数量VideoInfo Video10;/每个会员最多借10张影碟file1.open(Customer.txt,ios:in); file1idPersonNameLeftMoneynCount;for(int i=0;iVideoi.BeginTimeVideoi.EndTimeVideoi.VideoName;while(file1.good() for(int i=0;inext1=0; /顾客结点加入链表 if(cus) /若已经存在结点 Customer *c2; c2=cus; while(c2-next1) /查找尾结点 c2=c2-next1; c2-next1=c; /连接 else /若不存在结点(表空) cus=c; /连接 file1Videoi.BeginTimeVideoi.EndTimeVideoi.VideoName;file1.close(); void application:save()ofstream file(video.txt,ios:out); ofstream file1(Customer.txt,ios:out); char c; coutc; if(toupper(c)!=Y)return; video *v=vid; while(v) fileVnameCountryTypeProducerDirectorStarNumbernext; file.close();Customer *cu=cus; while(cu) file1idPersonNameLeftMoneynCountVideonext1; file1.close();coutn保存成功.n; void application:Rent()int number;Customer *c1;c1=cus;cout请输入会员姓名:Cname;while(c1) if(c1-Name=Cname) break; else c1=c1-next1; if(c1!=NULL)coutc1; coutnumber; if(number10-c1-nCount) cout租赁数目超过限定值!c1-LeftMoney)cout余额不足,请充值或减少影碟数!endl;if(numbernCount&number*20LeftMoney)c1-nCount=number;for(int i=0;inumber;i+)coutc1-Videoi.BeginTime;coutc1-Videoi.VideoName;c1-LeftMoney-=number*20;couttt租赁成功!endl;elsecout未找到该会员,请先注册!endl;void application:Return()int number,time;Customer *c1;c1=cus;cout请输入会员姓名:Cname;while(c1) if(c1-Name=Cname) break; else c1=c1-next1; if(c1!=NULL)coutc1;Customerinfo(Cname); coutnumber;c1-nCount=c1-nCount-number;for(int i=0;inumber;i+)coutc1-Videoi.VideoName;coutc1-Videoi.EndTime;couttime;if(time%3=0) c1-LeftMoney=c1-LeftMoney+20-time/3;elsec1-LeftMoney=c1-LeftMoney+20-time/3-1;couttt扣费成功!endl;couttt*归还成功*n;elsecout未找到该会员,请确认!Type=Type) break; else v1=v1-next; if(v1!=NULL)coutv1;elsecout未找到该类型的碟片!endl;void application:Checkall()int Type;char c;cout选择要查找的碟片类型(1.喜剧2.悲剧3.科幻片4.悬疑剧5.历史剧6.惊悚片7.其他):Type;search(Type);cout*以上为类型所有碟片*endl;cout是否继续查找【Y/N】?c;if(toupper(c)=Y)Checkall();return ;elsereturn ;system(pause);void application:Check(string vidname)video *v1;v1=vid;while(v1) if(v1-Vname=vidname) break; else v1=v1-next; if(v1!=NULL)coutv1;elsecout未找到该碟片!endl;void application:Addvideo()system(cls);video *v,*v2; /新结点指针 string Vname; /碟片名称string Country; /国家int Type=7; /类型string Producer; /制片人string Director; /导演string Star; /主演明星int Number=0; /库存量char c;coutn* 新增碟片信息 *n; /输入碟片信息coutVname; coutVname=Vname)break; else v1=v1-next; if(v1!=NULL)cout该碟片已存在,是否修改该碟片信息(Y/N) c;if(toupper(c)=Y)cout该碟片信息为:endl;Check(Vname);coutendl;Modifyvideo(Vname);return ;elsereturn ;coutCountry;coutType;coutProducer;coutDirector;coutStar;coutNumber;v=new video(Vname,Country,Type,Producer,Director,Star,Number);v-next=0;/碟片结点加入链表 if(vid) /若已经存在结点 v2=vid; while(v2-next) /查找尾结点 v2=v2-next; v2-next=v; /连接 else /若不存在结点(表空) vid=v; /连接 save();coutttt *添加成功*nendl;cout是否继续添加(Y/N) c;if(toupper(c)=Y)Addvideo();return ;elsereturn ;void application:Deletevideo()system(cls);char c;string Vname; coutn* 删除信息 *n; coutVname; coutVname=Vname) break; else v2=v1; v1=v1-next; /删除结点 if(v1!=NULL)/若找到结点,则删除 cout所要删除的碟片信息如下:nendl;coutv1;coutc;if(toupper(c)!=Y)return;if(v1=vid) /若要删除的结点是第一个结点 vid=v1-next; delete v1; else /若要删除的结点是后续结点 v2-next=v1-next; delete v1; save();couttt*删除成功*n;cout是否继续删除(Y/N) c;if(toupper(c)=Y)Deletevideo();return ;elsereturn ; else /未找到结点 coutVname=vidname) break; else v1=v1-next; if(v1!=NULL)/若找到结点 system(cls);cout所要修改的碟片信息如下:nendl;coutv1;docout1.修改碟片名称 2.修改国家 3. 修改类型 4.修改制片人 ;cout5. 修改导演 6.修改主演 7.修改库存量 8. 退出修改 nendl;cout请选择(1-8)要修改的信息nc;if(c!=8)coutv1-Vname; break;case 2: cinv1-Country; break;case 3: cinv1-Type; break;case 4: cinv1-Producer; break; case 5: cinv1-Director; break;case 6: cinv1-Star; break;case 7: cinv1-Number;break;default: break;while(c!=8);coutt *修改成功*nendl; cout是否继续修改(Y/N): c; if(toupper(c)=Y) coutvidname; coutendl; Modifyvideo(vidname); return ; elsereturn ;else /未找到结点 coutName=Cname) break; else c1=c1-next1; if(c1!=NULL)coutc1;elsecout未找到该会员!endl;void application:Add()system(cls);Customer *c,*c2; /新结点指针 string idPerson; /会员账号string Name;/会员姓名int LeftMoney=0;/会员剩余金额int nCount=0;/所借碟片数量char a;coutn* 新增会员信息 *n; coutName; coutName=Name)break; else c1=c1-next1; coutidPerson;coutLeftMoney;nCount=0;c=new Customer(idPerson,Name,LeftMoney,nCount);c-next1=0;if(cus) c2=cus; while(c2-next1) c2=c2-next1; c2-next1=c; else cus=c; save();coutttt *注册成功*nendl;cout是否继续(Y/N) a;if(toupper(a)=Y)Add();return ;elsereturn ;void application:Delete()system(cls);char a;string Name; coutn* 删除信息 *n; coutName; coutName=Name) break; else c2=c1; c1=c1-next1; if(c1!=NULL) cout所要删除的会员信息如下:nendl;coutc1;couta;if(toupper(a)!=Y)return;if(c1=cus) cus=c1-next1; delete c1; else c2-next1=c1-next1; delete c1; save();couttt*删除成功*n;cout是否继续删除(Y/N) a;if(toupper(a)=Y)Delete();return ;elsereturn ; else /未找到结点 coutName=Cname) break; else c1=c1-next1; if(c1!=NULL)/若找到结点 system(cls);cout所要修改的会员信息如下:nendl;coutc1;docout1.修改姓名 2.修改编号 3.充值 4.退出 nendl;cout请选择(1-4)要修改的信息na;if(a!=4)coutc1-Name; break;case 2: cinc1-idPerson; break;case 3: cinc1-LeftMoney;break;default: break;while(a!=4);coutt *修改成功*nendl; cout是否继续修改(Y/N)
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年黑龙江省齐齐哈尔市单招职业倾向性考试题库含答案详解
- 2026年湖南都市职业学院单招职业技能考试题库参考答案详解
- 2026年成都文理学院单招职业倾向性考试题库参考答案详解
- 2026年唐山职业技术学院单招职业适应性测试题库及答案详解一套
- 2026年上海中医药大学单招职业技能考试题库参考答案详解
- 教师求职面试题及答案
- 电梯维保安全责任协议书范本
- 2025年昆明市呈贡区城市投资集团有限公司及下属子公司员工岗公开招聘11人备考题库附答案详解
- 2026年甘肃一市教育系统招聘37人备考题库及一套答案详解
- 广州市海珠区人民政府办公室2026年公开招聘雇员备考题库及答案详解一套
- 2025年人民法院聘用书记员考试试题及答案
- 2025安徽交控集团安联公司所属企业招聘2人笔试考试参考试题及答案解析
- 新疆兵地联考试卷及答案
- 2025年急性肺栓塞诊断和治疗指南解读课件
- 2025年秋小学音乐湘艺版四年级上册期末测试卷及答案(三套)
- 小学生女生安全教育课件-1
- 2025至2030汽车车轮行业项目调研及市场前景预测评估报告
- 反邪教反渗透课件
- 社区商业综合体商业计划书
- 老年人糖尿病课件
- DB11∕T 1831-2021 装配式建筑评价标准
评论
0/150
提交评论