Question: C++ struct problem Template: #include using namespace std; enum Genre {ACTION, COMEDY, DRAMA, ROMANCE, THRILLER}; struct Movie { string title; Genre genre; // only one
C++ struct problem 
Template:
#include
enum Genre {ACTION, COMEDY, DRAMA, ROMANCE, THRILLER};
struct Movie { string title; Genre genre; // only one genre per movie int duration; // in minutes };
struct TimeSlot { Movie movie; // what movie Time startTime; // when it starts };
void printMovie(Movie mv){ string g; switch (mv.genre) { case ACTION : g = "ACTION"; break; case COMEDY : g = "COMEDY"; break; case DRAMA : g = "DRAMA"; break; case ROMANCE : g = "ROMANCE"; break; case THRILLER : g = "THRILLER"; break; } cout
int main() { Movie movie1 = {"Back to the Future", COMEDY, 116}; Movie movie2 = {"Black Panther", ACTION, 134};
TimeSlot morning = {movie1, {9, 15}}; TimeSlot daytime = {movie2, {12, 15}}; TimeSlot evening = {movie2, {16, 45}};
}
Task C. TimeSlot ending time and printTimeSlot In the same program time.cpp implement your own printing function printTimeSlot(TimeSlot ts) It should make output in the following format: Back to the Future COMEDY (116 min) [starts at 9:15, ends by 11:11] The ending time is the starting time + movie duration. Write main function that defines at least five time slots morning , daytime , and evening defined previously, plus add a couple of your own time slots with some of your favorite movies (their duration time can be found in IMDB). The program output should look like: $ ./time Back to the Future COMEDY (116 min) [starts at 9:15, ends by 11:11] Black Panther ACTION (134 min) [starts at 12:15, ends by 14:29] Black Panther ACTION (134 min) [starts at 16:45, ends by 18:59] -your time slot #1- -your time slot #2- When defining your own time slots, please make sure they end before midnight, 23:59, so the ending time does not show the next day. Task C. TimeSlot ending time and printTimeSlot In the same program time.cpp implement your own printing function printTimeSlot(TimeSlot ts) It should make output in the following format: Back to the Future COMEDY (116 min) [starts at 9:15, ends by 11:11] The ending time is the starting time + movie duration. Write main function that defines at least five time slots morning , daytime , and evening defined previously, plus add a couple of your own time slots with some of your favorite movies (their duration time can be found in IMDB). The program output should look like: $ ./time Back to the Future COMEDY (116 min) [starts at 9:15, ends by 11:11] Black Panther ACTION (134 min) [starts at 12:15, ends by 14:29] Black Panther ACTION (134 min) [starts at 16:45, ends by 18:59] -your time slot #1- -your time slot #2- When defining your own time slots, please make sure they end before midnight, 23:59, so the ending time does not show the next day
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
