POBtPOB actorsnumActorsa numActors fin1taid return numActors int

Pobtpob actorsnumactorsa numactors fin1taid return

This preview shows page 2 - 5 out of 7 pages.

actors[numActors]=a;numActors++;fin1>>taid;}return numActors;}int loadMovies(Movie movies[]){
Background image
ifstream fin2;Movie m;int tcode;string tmname;float tgross;float trating;string tgenre;int day;int month;int year;char ch; Date treleasedate;fin2.open("movies.txt");if(!fin2.is_open()){cout << "File not found." << endl;return 1;}int numMovies=0; fin2>>tcode;while(tcode!=0 && numMovies<100){fin2>> tmname>> tgenre>> day>> ch>> month>> ch>> year>> tgross>> trating;m.code=tcode;m.name=tmname;m.genre=tgenre;treleasedate.day=day;treleasedate.ch=ch;treleasedate.month=month;treleasedate.ch=ch;treleasedate.year=year;m.releasedate=treleasedate;m.gross=tgross;m.rating=trating;movies[numMovies]=m;numMovies++;fin2>>tcode;}return numMovies;}int loadCast(Cast casts[]){ifstream fin3;fin3.open("cast.txt");if(!fin3.is_open()){cout << "File not found." << endl;return 1;}Cast c;int numCast=0; int tmcode;string trole;string taid;fin3>>tmcode;while(tmcode!=0){
Background image
fin3>>taid>>trole;c.mcode=tmcode;c.aid= taid;c.role= trole;casts[numCast]=c;numCast++;fin3>>tmcode;}return numCast;}//This function prints the menu options and prompts the user to enter a choice.void printMenu(){int choice;cout<<"\t\t MENU"<<endl;cout<<"---------------------------"<<endl;cout<<"1. Movie Information"<<endl;cout<<"2. Movie Cast"<<endl;cout<<"3. Actor Information"<<endl;cout<<"4. Actor Filmography"<<endl;cout<<"5. Latest Releases"<<endl;cout<<"6. Coming Soon"<<endl;cout<<"7. Top Rated Movies"<<endl;cout<<"8. Exit"<<endl;}int searchActorById(Actor actors[], int numActors, string actorId){for(int i=0;i<numActors; i=i+1){if(actors[i].id==actorId){return i;}}return -1;}int searchActorByName(Actor actors[], int numActors, string fName, string lName){for(int i=0; i<numActors; i=i+1){if((actors[i].fname==fName) && (actors[i].lname==lName)){return i;}}return -1;}
Background image
Image of page 5

You've reached the end of your free preview.

Want to read all 7 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes