




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、#include<iostream> #include<fstream> #include<cstdlib> using namespace std;/ 第一部分:用戶類class userpublic:user() user(string name):name(name) user(string name,int level,int age,string occupation,stringhobby,string email);string getusername()return name; void writeuser();friend istream
2、&operator>>(istream &in,user &u);private:string name;int level;int age;string occupation;string hobby;string email;user:user(stringname,int level,int age,string occupation,stringhobby,string email):name(name),age(age),occupation(occupation),hobby(hobby),email (email)ofstream outfil
3、e;outfile.open("userfile.txt",ios:app);outfile<<name<<""<<level<<""<<age<<""<<occupation<<" "<<hobby<<" "<<email<<endl;outfile.close();void user:writeuser()ofstream out
4、file;outfile.open("userfile.txt",ios:app);cout<<"enter user's name: "cin>>name;cout<<"enter user's level: "cin>>level;cout<<"enter user's age: "cin>>age;cout<<"enter user's occupation: "cin>
5、;>occupation;cout<<"enter user's hobby: "cin>>hobby;cout<<"enter user's email: "cin>>email;cout<<endl;outfile<<name<<""<<level<<""<<age<<""<<occupation<<" &
6、quot;<<hobby<<" "<<email<<endl;outfile.close();istream &operator>>(istream &in,user &u)in>>;return in;/*/ 第二部分:電影類class moviepublic:movie()movie(string name):name(name)movie(string name,int year,string direct,stringrole,stringcompany,st
7、ring 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,stringrole
8、,stringcompany,string grade):name(name),year(year),direct(direct),role(role),company(compa ny),grade(grade)ofstream outfile;outfile.open("moviefile.txt",ios:app);outfile<<name<<""<<year<<""<<direct<<""<<role<<&qu
9、ot; "<<company<<" "<<grade<<endl;outfile.close();void movie:writemoive()ofstream outfile;outfile.open("moviefile.txt",ios:app);cout<<"please enter movie's name: "cin>>name;II.cout<<"please enter the movie release y
10、earcin>>year;cout<<"please enter movie's direct: "cin>>direct;cout<<"please enter movie's role: "cin>>role;cout<<"please enter the film production company: "cin>>company;cout<<"Please enter the movie classific
11、ation: "cin>>grade;cout<<endl;outfile<<name<<" "<<year<<" "<<direct<<" "<<role<<" "<<company<<" "<<grade<<endl;outfile.close();istream &operator>>(istr
12、eam &in,movie &m)in>>;return in;/*/ 第三部分:影評(píng)類class commentpublic:comment(movie moviecomment);comment(movie moviecomment,user usercomment,double score,stringconnection);comment()void writecomment(user rcomment);private:string username;string moviename;double score;string connection
13、;static int commentcount;int comment:commentcount=0;comment:comment(movie moviecomment)commentcount+;moviename=moviecomment.getmoviename();cout<<"video linkII.cin>>connection;comment:comment(moviemoviecomment,userusercomment,doublescore,string connection):score(score),connection(con
14、nection)commentcount+;moviename=moviecomment.getmoviename();username=usercomment.getusername();ofstream outfile;outfile.open("commentfile.txt",ios:app);outfile<<moviename<<""<<username<<""<<score<<" "<<connection<&l
15、t;""<<commentcount<<endl;outfile.close();void comment:writecomment(userusercomment)username=usercomment.getusername();ofstream outfile;outfile.open("commentfile.txt",ios:app);cout<<"please rate the film: "cin>>score;outfile<<moviename<&l
16、t;""<<username<<""<<score<<" "<<connection<<""<<commentcount<<endl;outfile.close();/*/ 第四部分:菜單系統(tǒng)功能函數(shù)編輯部分void initialization()cout<<"Menu system ready"<<endl;movie Zootopia("Zootopia &qu
17、ot;,2016,"Howard ","Jodie ","Disney","PG");movie Begonia ("Begonia ",2016,"LiangXuan","chun","Enlight","PG");movie Doraemon("Doraemon ",2016,"Shinosuke","Doraemon","Toho"
18、," PG");void writenewuser()cout<<"you can add user's infomation:"<<endl;cout<<endl;user newuser;newuser.writeuser();void readuser()cout<<"this is user's infomation:"<<endl;cout<<endl;cout<<"name levelageoccupationho
19、bbyemail"<<endl;ifstream in("userfile.txt");char p;while(in.get(p)cout.put(p);void writenewmoive()movie newmovie;newmovie.writemoive();void readmovie()cout<<"this is movie's infomation:"<<endl;cout<<endl;cout<<"movienameyeardirectroleco
20、mpany grade"<<endl;ifstream in("moviefile.txt");char p;while(in.get(p)cout.put(p);void writenewcomment()cout<<"you can add movie's infomation:"<<endl;user commentuser;movie commentmovie;cout<<"you can add comment's infomation:"<&l
21、t;endl;cout<<"please enter your name: "cin>>commentuser;cout<<"please enter moive's name: "cin>>commentmovie;comment newcomment(commentmovie);newcomment.writecomment(commentuser);void readcomment()cout<<"this is comment's infomation:&quo
22、t;<<endl;cout<<"Menu system clearing"<<endl;cout<<"movienameusernamescoreconnectioncommentcount"<<endl;ifstream in("commentfile.txt");char p;while(in.get(p)cout.put(p);void clearing()ofstream outfile;outfile.open("userfile.txt");o
23、utfile.close();outfile.open("moviefile.txt");outfile.close();outfile.open("commentfile.txt");outfile.close();/*/ 第五部分,菜單系統(tǒng)實(shí)現(xiàn)部分void menuframe()cout<<"* *"<<endl;cout<<"* Welcome to the movie critic information management system *"<<endl;
24、cout<<"*cout<<endl;"<<endl;cout<<""<<endl;cout<<"entermakemenusystemready"<<endl;cout<<""<<endl;cout<<"enterlookupuser'sinfomation"<<endl;cout<<""<<endl;cout&
25、lt;<"enterincreaseuser'sinfomation"<<endl;cout<<"cout<<"enterlookupmoive's"<<endl;infomation"<<endl;cout<<""<<endl;cout<<"enterincreasemoive'sinfomation"<<endl;"<<endl;cl
26、earing"<<endl;cout<<""<<endl;cout<<"enterlookupcomment'sinfomaition"<<endl;cout<<""<<endl;cout<<"enterincreasecomment'sinfomation"<<endl;cout<<"cout<<"entermakemenusystemcout<<""<<
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 二年級(jí)下冊(cè)數(shù)學(xué)教案- 撥一撥 北師大版
- 2025年中學(xué)職務(wù)崗位聘用合同
- 五年級(jí)下冊(cè)數(shù)學(xué)教案-6.5 圖形與幾何(平面圖形的周長(zhǎng)和面積(復(fù)習(xí))) ▏滬教版
- 人教版數(shù)學(xué)三年級(jí)上冊(cè)單元練習(xí)卷(易錯(cuò)題)-第五單元-倍的認(rèn)識(shí)(含答案)
- 2024年快速熱處理設(shè)備項(xiàng)目資金籌措計(jì)劃書代可行性研究報(bào)告
- 2024年灌裝包裝設(shè)備項(xiàng)目投資申請(qǐng)報(bào)告代可行性研究報(bào)告
- 2025年廣西金融職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)技能測(cè)試題庫(kù)審定版
- 2025年貴州建設(shè)職業(yè)技術(shù)學(xué)院?jiǎn)握新殬I(yè)傾向性測(cè)試題庫(kù)帶答案
- 2025屆黑龍江省“六校聯(lián)盟”高三上學(xué)期聯(lián)考生物試題及答案
- 別墅家裝保障合同范本
- 人教版小學(xué)六年級(jí)下冊(cè)音樂教案全冊(cè)
- 12J201平屋面建筑構(gòu)造圖集(完整版)
- 2024年個(gè)人信用報(bào)告(個(gè)人簡(jiǎn)版)樣本(帶水印-可編輯)
- 16J914-1 公用建筑衛(wèi)生間
- 20CS03-1一體化預(yù)制泵站選用與安裝一
- (完整版)四年級(jí)上冊(cè)數(shù)學(xué)豎式計(jì)算題100題直接打印版
- 大氣商務(wù)企業(yè)培訓(xùn)之團(tuán)隊(duì)合作的重要性PPT模板
- Opera、綠云、西軟、中軟酒店管理系統(tǒng)對(duì)比分析
- 楚才辦公室裝修設(shè)計(jì)方案20140315
- 人教版八年級(jí)(上冊(cè))物理習(xí)題全集(附答案)
- 電影院影務(wù)崗位工作流程
評(píng)論
0/150
提交評(píng)論