Movie Data

Directions:
Write a program that uses the structure named MovieData to store the following information about a movie:
Title
Director
Year Released
Running Time

Include a constructor that allows all four of these member data values to be specified at the time MovieData variable is created. The program should create. The MovieData variable and pass each one in turn to a function that displays the information about the movie in a clearly formatted manner. Pass the MovieData Variables to the display by value.

Code:
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

struct MovieData
{
double Title,// Movie Name
Director,// Movie Director
YearReleased,// Movie Release year
RunTime;// Movie length

};

struct MovieData2
{
string name;
string director;
string year;
double time;

Moviedata Movie;

MovieData2()
{
name = "unknown";
director = "unknown";
year = 0;
time = 0;

Movie.Title = Movie.Director = Movie.YearReleased = movie.RunTime = 0.00;
}
};


int main()
{
MovieData2 movie;

movie.name = "Godfather";
movie.director = "mario Puzo";
movie.year = 1972;
movie.time = 3;

I sort of hit a wall did it do something wrong because the whole create two MovieData variables is confusing me. Im not if Im doing it correctly either.

Thanks,
Make one struct and two instances of that same struct.
Last edited on
Topic archived. No new replies allowed.