




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
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,string hobby,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(string name,int level,int age,string occupation,stringhobby,stringemail):name(name),age(age),occupation(occupation),hobby(hobby),email(email)ofstream outfile;outf
3、ile.open("userfile.txt",ios:app);outfile<<name<<" "<<level<<""<<age<<" "<<occupation<<""<<hobby<<" "<<email<<endl;outfile.close();void user:writeuser()ofstream outfile;
4、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>>occupat
5、ion;cout<<"enter user's hobby: "cin>>hobby;cout<<"enter user's email: "cin>>email;cout<<endl;outfile<<name<<" "<<level<<""<<age<<" "<<occupation<<"<<hobb
6、y<<" "<<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,string grade);movi
7、e()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;role,stringmovie:movie(string name,int year,string direct,stringcompany,str
8、inggrade):name(name),year(year),direct(direct),role(role),company(company),g rade(grade)ofstream outfile;outfile.open("moviefile.txt",ios:app);outfile<<name<<" "<<year<<" "<<direct<<" "<<role<<""<<
9、;company<<" "<<grade<<endl;outfile.close();void movie:writemoive()ofstream outfile;outfile.open("moviefile.txt",ios:app);cout<<"please enter movie's name: "cin>>name;cout<<"please enter the movie release year : "cin>&
10、gt;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 classification: &quo
11、t;cin>>grade;cout<<endl;outfile<<name<<" "<<year<<""<<direct<<""<<role<<"<<company<<" "<<grade<<endl;outfile.close();istream &operator>>(istream &in,movie &a
12、mp;m)in>>;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 comment
13、count;int comment:commentcount=0;comment:comment(movie moviecomment)commentcount+;moviename=moviecomment.getmoviename();cout<<"video link : "cin>>connection;score,stringcomment:comment(movie moviecomment,user usercomment,doubleconnection):score(score),connection(connection)comm
14、entcount+;moviename=moviecomment.getmoviename();username=usercomment.getusername();ofstream outfile;outfile.open("commentfile.txt",ios:app);outfile<<moviename<<" "<<username<<" "<<score<<""<<connection<<" &q
15、uot;<<commentcount<<endl;outfile.close();void comment:writecomment(user usercomment)username=usercomment.getusername();ofstream outfile;outfile.open("commentfile.txt",ios:app);cout<<"please rate the film: "cin>>score;outfile<<moviename<<"
16、"<<username<<""<<score<<""<<connection<<" "<<commentcount<<endl;outfile.close();/*/ 第四部分:菜單系統(tǒng)功能函數(shù)編輯部分void initialization()cout<<"Menu system ready"<<endl;movie Zootopia("Zootopia ",2016
17、,"Howard","JodieDisney","PG");"LiangXuan","chun"Shinosuke","Doraemon","Tohomovie Begonia ("Begonia ",2016, ","Enlight","PG");movie Doraemon("Doraemon ",2016,PG");void writenewuser(
18、)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 level age occupation hobby email"<<endl;ifstr
19、eam 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<<"moviename year direct role companygrade"<<endl
20、;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:"<<endl;cout<<"plea
21、se 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:"<<endl;cout<<&q
22、uot;movienameusernamescoreconnectioncommentcount"<<endl;ifstream in("commentfile.txt");char p;while(in.get(p)cout.put(p);void clearing()cout<<"Menu system clearing"<<endl;ofstream outfile;outfile.open("userfile.txt");outfile.close();outfile.open(&
23、quot;moviefile.txt");outfile.close();outfile.open("commentfile.txt");outfile.close();/*/ 第五部分,菜單系統(tǒng)實現(xiàn)部分void menuframe()cout<<”*”<endl;cout<<"* Welcome to the movie critic information management system*"<<endl;cout<<”*”<<endl;cout<<endl;c
24、out<<""<<endl;cout<<"enter1make menu systemready"<<endl;cout<<""<<endl;cout<<"enter 2lookup user'sinfomation"<<endl;cout<<""<<endl;cout<<"enter3increaseuser'sinfomation&qu
25、ot;<<endl;cout<<""<<endl;cout<<"enter4look up moive'sinfomation"<<endl;cout<<""<<endl;cout<<"enter5increasemoive'sinfomation"<<endl;cout<<""<<endl;cout<<"enter 6 look up comment'sinfomaition"<<endl;cout<<""<<endl;cout<<"enter7increasecomment'sinfomation"<<endl;cout<<""<<endl;systemmenucout<<"enter8make menuclearing"<<endl;cout&l
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 山東省德州市齊河縣2024-2025學年八年級上學期期末生物學試題(含答案)
- 客戶溝通與反饋記錄
- 小王子遇見世界的觀后感
- 高中化學實驗設(shè)計與探究:化學反應(yīng)原理教案
- 《初高中英語語法比較與辨析教案》
- 不動產(chǎn)交易買賣協(xié)議書
- 中學生歷史事件故事讀后感
- 美容師儀器知識培訓課件
- 血液++課件-2024-2025學年北師大版生物七年級下冊
- 紅色故事鐵道游擊隊的愛國主義教育解讀
- 《當代廣播電視概論》(廣播電視發(fā)明與技術(shù)基礎(chǔ))課件
- 核心能力模型庫(-勝任力模型-)
- 高中地理 紐約的發(fā)展 紐約的輻射功能 城市的輻射功能 作業(yè)設(shè)計
- 5.3.2.2函數(shù)的最大(小)值 課件(共20張PPT)
- TSG-R0005-2022《移動式壓力容器安全技術(shù)監(jiān)察規(guī)程》(2022版)
- 2020 ACLS-PC-SA課前自我測試試題及答案
- 上市公司組織架構(gòu)策略
- 上海交通大學有機化學課件第二章烷烴
- DB34∕T 3968-2021 橋梁健康監(jiān)測系統(tǒng)運營維護與管理規(guī)范
- 加氣混凝土砌塊砌筑規(guī)范標準[詳]
- 定語從句漢譯英
評論
0/150
提交評論