PART A: Write a program that uses a structure named MovieData to store the follo
ID: 3556350 • Letter: P
Question
PART A: Write a program that uses a structure named MovieData to store the following information about a movie:
Title
Director
Year Released
Running Time (in minutes)
The 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.
PART B: Modify the Movie Data program written for Programming Challenge 1 to include two additional members that hold the movie's production costs and first-year revenues. Modify the function that displays that movie data to display the title, director, release year, running time, and first year's profit or loss.(modify part A by creating a new project, copy and paste part A code and modify it)
If you use Code::Blocks, it will be much better. Thank you.
Explanation / Answer
Dear,
A.
#include<iostream>
using namespace std;
//Structure declaration
struct MovieData
{
char Title[30];
char Director[20];
int Year;
int RunningTime;
};
//Function prototype
void ShowData(MovieData);
void main()
{
//Declaring variable1 to MovieData
MovieData movie1;
//Inputting data to movie1
//Inputting movie Data Member Title
cout<<"Enter Movie Title";
cin.getline(movie1.Title,30);
//Inputting movie Data Member Director
cout<<"Enter Direcor Name:";
cin.getline(movie1.Director,20);
//Inputting movie Data Member Year
cout<<"Enter year of Released:";
cin>>movie1.Year;
//Inputting movie Data Member Running Time
cout<<"Enter Running Time:";
cin>>movie1.RunningTime;
//Declaring and defining variable to MovieData
MovieData movie2={"SLUMDOG MILLIONAIRE
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.