Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Question: Can someone help me with the second movie and second director inpu

ID: 3768855 • Letter: C

Question

C++ Question: Can someone help me with the second movie and second director input/outputs? It''ll skip one and I don't know why and it won't take more than one word for the director/title for the second movie. Please and Thank you.

#include<iostream>

#include<string>

using namespace std;

struct MovieData

{

string movieTitle; //Movie Title(s)

string movieDirector; //Director(s) of movie

  int yearReleased; //Year Movie was released

  int runTime; //Running time (in minutes) of movie

};

void printmovie(MovieData movie);

int main()

{

MovieData movie1, movie2;

  //Get the title of the movie

  cout << "***Info of Movies*** ";

  cout << "Title of first movie: ";

getline(cin, movie1.movieTitle);

  //Get the Director of the movie

  cout << "Director(s): ";

getline(cin, movie1.movieDirector);

  //Get the Year the movie was released

  cout << "Year of release: ";

  cin >> movie1.yearReleased;

  //Get the Running time (in minutes) of movie;

  cout << "How long is the movie?: ";

  cin >> movie1.runTime;

  cout << endl;

  //Get second movie info

  cout << "Title of second movie: ";

getline (cin, movie2.movieTitle);

  cout << endl;

  //Get the Director of the movie

  cout << "Director(s): ";

getline(cin, movie2.movieDirector);

  //Get the Year the movie was released

  cout << "Year of release: ";

  cin >> movie2.yearReleased;

  //Get the Running time (in minutes) of movie;

  cout << "How long is the movie?: ";

  cin >> movie2.runTime;

  cout << " ************ ";

printmovie(movie1);

printmovie(movie2);

  system("pause");

  return 0;

}

void printmovie(MovieData movie)

{

  cout << endl;

  cout << movie.movieTitle;

  cout << " (" << movie.yearReleased << ") ";

  cout << "Directed by: " << movie.movieDirector << endl;

  cout << "Running Time: " << movie.runTime << endl;

  cout << endl;

}

Explanation / Answer

use the following

//Get second movie info
cout << "Title of second movie: ";
std::getline (std::cin, movie2.movieTitle);
cout << endl;

//Get the Director of the movie
cout << "Director(s): ";
std::getline(std::cin, movie2.movieDirector);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote