Hi i need help writing this program in C++. YOU MUST USE A LINKED LIST CLASS . u
ID: 3767481 • Letter: H
Question
Hi i need help writing this program in C++. YOU MUST USE A LINKED LIST CLASS .
using object oriented programing write a C++ program that stores and manipulates TV program information. Your program should read TV program information from a file called TVData.dat. The file contains the name of the show, Day show is on, time shown, and approximate number of viewers Your program should allow a user to do several things: Print the complete list of TV shows and all related data. Type in a TV show title and retrieve the day and time the show is on. Find TV shows with number of viewers greater than 20000 Add a show and all related data to the list Print the movie TV shows in order of popularity, greatest number of viewers to least. Please remeber to use a linked list class. The contents of the TV.dat file are: House of Cards Wednesday 8:00pm 20278 Big Bang Theory Tuesday 8:00pm 23574 Modern Family Thursday 9:00pm 15546 The 100 Monday 10:00pm 13245 Scandal Tuesday 9:00pm 16678
Explanation / Answer
#include #include #include #include using namespace std; class TvShow { private: struct Show{ string name; string day; string time; string views; Show *next; }; Show *head; public: /* TvShow Show(string n, string d, string t, double v) { name = n; day = d; time = t; views = v; }*/ TvShow() { head = NULL; } void Prepend(string n, string d, string t, string v) { Show *newNode; Show *curr; newNode = new Show; newNode->name = n; newNode->day = d; newNode->time = t; newNode->views = v; newNode->next = NULL; newNode->next = head; head = newNode; } void Display() { Show *curr; curr = head; while (curr != NULL){ coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.