int actors int numActors string fName string lName

# Int actors int numactors string fname string lname

This preview shows page 4 - 6 out of 6 pages.

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; } //This function searches the array of Movie structures for a given movie by their name. If the Movie with that name is found, the function returns the location in the array //where the movie was found. If the movie is not found, the function returns -1. int searchMovieByName(Movie movies[], int numMovies, string movieName){ for(int i=0; i<numMovies; i=i+1){ if(movies[i].movieName==movieName){ return i; } } return -1; } //This function searches the array of Movie structures for a given movie id. If the Movie with that movie id is found, the function returns the location in the array //where the movie was found. If the movie is not found, the function returns -1. int searchMovieById(Movie movies[], int numMovies, int movieId){ for(int i=0; i<numMovies; i=i+1){ if(movies[i].movieId==movieId){ return i; } } return -1; } // This functions searches for a movie. If the movie is found all of the information pertaining to the movie is printed. // If it is not found an appropriate error message is printed. void option1(Movie movies[], int numMovies, string movieName){ int location= searchMovieByName(movies,numMovies,movieName); if(location!=-1) printMovie(movies,location); else cout<<"The movie was not found."; } //This functions searches for a movie by name and prints the list of all the actors and the roles they played in the movie. void option2(Movie movies[], int numMovies, Actor actors[], int numActors,Cast casts[], int numCast){ } // This functions searches for an actor by name. If the actor is found all of the information pertaining to the actor is printed. // If it is not found an appropriate error message is printed. void option3 (Actor actors[], int numActors, string fName, string lName){
int location= searchActorByName(actors,numActors,fName,lName); if(location!=-1) printActor(actors,location); else cout<<"Actor was not found."<<endl; } //This functions searches for an actor's name and list the name of the movie (s) and roles(s) played in the movie of all the movies the actor has acted //in if the actor exists. If the actor exists but has not acted in any of the listed movies, display "Actor has not acted in any movie."

#### You've reached the end of your free preview.

Want to read all 6 pages?

• Spring '17
• Computer Programming, Return statement, Carriage return, #include, int age, 1 Billion dollars, print functions

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern