Answer to Question #42631 in C++ for michael taye

Question #42631
Define a structure called Movie which has the members Title, Genre, and Year. Then Declare 3 variables of type Movie to describe your 3 favorite movies and display their Title as an output
Expert's answer
#include <iostream>
struct Movie
std::string Title;
std::string Genre;
int Year;
int main()
Movie movie1;
Movie movie2;
Movie movie3;
movie1.Title = "The Dark Knight";
movie1.Genre = "Action";
movie1.Year = 2008;
movie2.Title = "The Lord of the Rings: The Return of the King";
movie2.Genre = "Fantasy";
movie2.Year = 2003;
movie3.Title = "Forrest Gump";
movie3.Genre = "Drama";
movie3.Year = 1994;
std::cout << "Movie 1: " << movie1.Title << std::endl;
std::cout << "Movie 2: " << movie2.Title << std::endl;
std::cout << "Movie 3: " << movie3.Title << std::endl;
return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog