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
1
Expert's answer
2014-05-22T09:13:25-0400
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS