已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
精品文档#include#include#includeusing namespace std;/第一部分:用户类 class userpublic:user() user(string name):name(name) user(string name,int level,int age,string occupation,string hobby,string email);string getusername()return name; void writeuser(); friend istream &operator(istream &in,user &u); private:string name;int level;int age;string occupation;string hobby;string email;user:user(string name,int level,int age,string occupation,string hobby,string email):name(name),age(age),occupation(occupation),hobby(hobby),email(email)ofstream outfile;outfile.open(userfile.txt,ios:app); outfilename level age occupation hobby emailendl;outfile.close();void user:writeuser()ofstream outfile;outfile.open(userfile.txt,ios:app);coutname;coutlevel;coutage;coutoccupation;couthobby;coutemail;coutendl;outfilename level age occupation hobby email(istream &in,user &u);return in; /*/第二部分:电影类 class moviepublic:movie()movie(string name):name(name)movie(string name,int year,string direct,string role,string company,string grade);movie()void writemoive();string getmoviename()return name;friend istream &operator(istream &in,movie &m);friend class comment;private:string name;int year;string direct;string role;string company;string grade;movie:movie(string name,int year,string direct,string role,string company,string grade):name(name),year(year),direct(direct),role(role),company(company),grade(grade) ofstream outfile;outfile.open(moviefile.txt,ios:app); outfilename year direct role company gradeendl;outfile.close(); void movie:writemoive()ofstream outfile;outfile.open(moviefile.txt,ios:app);coutname;coutyear;coutdirect;coutrole;coutcompany;coutgrade;coutendl;outfilename year direct role company grade(istream &in,movie &m);return in; /*/第三部分:影评类 class commentpublic:comment(movie moviecomment);comment(movie moviecomment,user usercomment,double score,string connection);comment()void writecomment(user rcomment);private:string username;string moviename;double score;string connection; static int commentcount;int comment:commentcount=0;comment:comment(movie moviecomment) commentcount+;moviename=moviecomment.getmoviename();coutconnection; comment:comment(movie moviecomment,user usercomment,double score,string connection):score(score),connection(connection)commentcount+;moviename=moviecomment.getmoviename();username=usercomment.getusername(); ofstream outfile;outfile.open(commentfile.txt,ios:app); outfilemoviename username score connection commentcountendl; outfile.close();void comment:writecomment(userusercomment)username=usercomment.getusername();ofstream outfile;outfile.open(commentfile.txt,ios:app); coutscore;outfilemoviename username score connection commentcountendl;outfile.close();/*/第四部分:菜单系统功能函数编辑部分 void initialization()coutMenu system readyendl;user ali(ali,7,32,housemom,cooking ); user bob(bob,9,21,teacher ,readbook,21736172327); user cau(cau,2,19,artist ,drawing ,27836128323); movie Zootopia(Zootopia ,2016,Howard ,Jodie ,Disney ,PG); movie Begonia (Begonia ,2016,LiangXuan,chun ,Enlight,PG); movie Doraemon(Doraemon ,2016,Shinosuke,Doraemon,Toho , PG); comment Zootopia1(Zootopia,ali,8.7,); comment Zootopia2(Zootopia,bob,9.2,); comment Begonia1 (Begonia ,cau,4.1, );void writenewuser() coutyou can add users infomation:endl; coutendl;user newuser;newuser.writeuser();void readuser()coutthis is users infomation:endl;coutendl;coutname level age occupation hobby emailendl;ifstream in(userfile.txt);char p;while(in.get(p)cout.put(p);void writenewmoive()movie newmovie;newmovie.writemoive();void readmovie()coutthis is movies infomation:endl; coutendl;coutmoviename year direct role company gradeendl;ifstream in(moviefile.txt);char p;while(in.get(p)cout.put(p);void writenewcomment()coutyou can add movies infomation:endl;user commentuser;movie commentmovie;coutyou can add comments infomation:endl;coutcommentuser;coutcommentmovie;comment newcomment(commentmovie);newcomment.writecomment(commentuser);void readcomment()coutthis is comments infomation:endl;coutmoviename username score connection commentcountendl;ifstream in(commentfile.txt);char p;while(in.get(p)cout.put(p);void clearing()coutMenu system clearingendl;ofstream outfile; outfile.open(userfile.txt); outfile.close(); outfile.open(moviefile.txt); outfile.close(); outfile.open(commentfile.txt); outfile.close();/*/第五部分,菜单系统实现部分 void menuframe()cout*endl; cout* Welcome to the movie critic information management system *endl; cout*endl; coutendl; cout-endl; cout enter 1 make menu system ready endl; cout- endl; cout enter 2 look up users infomation endl; cout-endl; cout enter 3 increase users infomation endl; cout-endl; cout enter 4 look up moives infomation endl; cout-endl; cout enter 5 increase moives infomation endl; cout-endl; cout enter 6 look up comments infomaition endl; cout-endl; cout enter 7 increase comments infomation endl; cout-endl; cout enter 8 make menu system clearing endl; cout-endl; cout enter 0 exit menu system endl; cout-endl; coutendl; coutendl;int menuinput() int order;coutorder; coutendl; return order;void menuimplementation(int order) switch(order) case 0: exit(0); break; case 1: initialization(); break; case 2: readuser(); break; case 3: writenewuser(); break; case 4: readmovie(); break; case 5: writenewmoive(); break; case 6: readcomment(); break; case 7: wri
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025广东深圳市优才人力资源有限公司招聘聘员(派遣至龙岗区住房和建设局)1人考试笔试模拟试题及答案解析
- 2026广西玉林市兴业县中医医院人才招聘25人考试笔试模拟试题及答案解析
- 2025江苏泰州市中医院招聘高层次专业技术人员28人考试笔试模拟试题及答案解析
- 2025广东汕尾市华侨管理区就业见习招募7人(第三批)笔试考试参考题库及答案解析
- 2025安徽合肥市巢湖市宁德时代(巢湖基地)招聘考试笔试备考题库及答案解析
- 2025年枣庄峄城区卫生健康系统公开招聘工作人员(27人)考试笔试模拟试题及答案解析
- 2026安徽选聘“警民联调”室专职人民调解员20人笔试考试备考试题及答案解析
- 2025年甘肃省平凉市灵台县招聘公费师范毕业生和国家“优师计划”师范生考试笔试参考题库附答案解析
- 2025广东深圳市龙岗区属公立医院选聘高层次和急需紧缺人才22人考试笔试备考题库及答案解析
- 2025年伊春嘉荫县招聘公益性岗位人员102人笔试考试参考题库及答案解析
- 2025年瑜伽行业市场发展可行性研究报告及总结分析
- 2025云南昆明国际会展中心有限公司社会招聘8人备考题库及答案详解(历年真题)
- DB5206∕T 128-2020 梵净抹茶 加工技术规程
- 2025年国企考试综合基础知识题库及答案解析
- 人工智能在医学影像分析中的应用
- 2025国元农业保险股份有限公司安徽分公司下半年社会招聘12人笔试考试参考试题及答案解析
- 2025年山东省行政执法资格考试典型题题库(含答案)
- 中央空调维护保养操作手册
- 2025年超星尔雅学习通《新媒体营销》考试备考题库及答案解析
- 《文献检索》期末考试复习试题和答案解析
- 2025年辽宁省建筑安全员《B证》考试题库及答案
评论
0/150
提交评论