Hello people. I have a favor to ask. My programming challenge is to write a program that uses a structure named movie data to store the following, title, director, year released, running time.
this program should create two moviedata variables store values in their members, and pass each one in turn to a function that displays the information about the movie in a clearly formatted manner.
This is what i wrote for the code.
#include <iostream>
using namespace std;
const int SIZE = 50; //Array size.
struct Moviedata
{
char movieTitle[SIZE]; //Movie Title.
char movieDirector[SIZE]; //The director of the movie.
int yearReleased; //The year the movie was released.
int runningTime; //Running time in minutes
};
int main()
{
Moviedata first = {"The Hangover", "Todd Phillips", 2009, 99};
Moviedata second = {"Transformers", "Michael Bay", 2007, 135};
cout << "\nHere is the data for the first movie.\n";
//Display data stored for the first movie.
cout << "Movie Tittle: " << first.movieTitle << endl;
cout << "Director of the movie: " << first.movieDirector << endl;
cout << "The year the movie was released: " << first.yearReleased <<endl;
cout << "The running time of the movie in minutes: " << first.runningTime << endl;
cout << "\nHere is the data for the second movie.\n";
//Display data stored for the second movie.
cout << "Movie Title: " << second.movieTitle << endl;
cout << "Director of the movie: " << second.movieDirector << endl;
cout << "The year the movie was released: " << second.yearReleased << endl;
cout << "The running time of the movie in minutes: " << second.runningTime << endl;
return 0;
}
My first question is if i answered the question correctly? if not please tell me if i missed something.
Second im pretty confident that i wrote the program correctly, there are no build errors, but for some reason it does not want to run the program. If i change something on purpose to get an error it will pick that up and tell me, but it won't run or even attempt to run when the code is like above. Any suggestions or those it run for you guys as is.