C++觀影網(wǎng)站管理系統(tǒng)_第1頁
C++觀影網(wǎng)站管理系統(tǒng)_第2頁
C++觀影網(wǎng)站管理系統(tǒng)_第3頁
C++觀影網(wǎng)站管理系統(tǒng)_第4頁
C++觀影網(wǎng)站管理系統(tǒng)_第5頁
免費(fèi)預(yù)覽已結(jié)束,剩余13頁可下載查看

下載本文檔

版權(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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論