下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rè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)實(shí)現(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)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 【初中歷史教案、學(xué)案、備課】第2課 原始農(nóng)耕生活 教案
- 建設(shè)工程招投標(biāo)和合同管理(教學(xué)課件)工程招投標(biāo)與合同管理總復(fù)習(xí)
- 光的折射課件教學(xué)
- 2024年交叉極化傳輸用微波天線項(xiàng)目合作計(jì)劃書
- 2024年焙烤食品項(xiàng)目發(fā)展計(jì)劃
- 汽車制造預(yù)制塊運(yùn)輸合同
- 架空運(yùn)輸線操作員工合同
- 糧油配送車輛租賃協(xié)議
- 藝術(shù)品代理銷售居間協(xié)議
- 超市改造清包合同模板
- 常見有機(jī)溶劑縮寫
- 安全生產(chǎn)獎(jiǎng)勵(lì)與處罰制度
- 變頻器變頻altivar71說明書
- 精密工程控制測量復(fù)測成果報(bào)告
- 人民幣知識介紹_ppt
- abb繼電保護(hù)615系列操作手冊
- 尾礦庫在線監(jiān)測方案
- 《放射物理與防護(hù)》第九章
- 中信銀行擔(dān)保機(jī)構(gòu)管理辦法(共10頁)
- TROXLER3440核子密度儀
- 人員花名冊表格
評論
0/150
提交評論