Question: C++: So far I somewhat made the bottom list for the code: -------------------------------------------- #include #include #include using namespace std; struct movie { string title; int
C++:
So far I somewhat made the bottom list for the code:
--------------------------------------------
#include
#include
#include
using namespace std;
struct movie
{
string title;
int viewed_year;
int rating;
movie* next;
};
void print_linked_list_arrow(const movie* head)
{
cout
cout
for (const movie* p = head; p; p = p->next)
{
cout title;
cout viewed_year;
cout rating
}
}
int main()
{
movie* firstmovie = 0;
movie a = { "Movie1", 2000, 5 };
movie b = { "Movie2", 2015, 4 };
movie c = { "Movie3", 2017, 3 };
a.next = firstmovie;
firstmovie = &a;
b.next = firstmovie;
firstmovie = &b;
c.next = firstmovie;
firstmovie = &c;
print_linked_list_arrow(firstmovie);
}
--------------------------------------------
Not sure how to do the rest of the code, any help is appreciated, thank you
linked list to store your favorit Create a movie struct including the title, the year you viewed, and the rating you gave Prompt to the user to enter information of three movies, create a movie object for each of them, and store them into a se a vie linked list. Write a function to display the movie information by passing the pointer of the first movie object in the linked list: void list_movie(const Movie*); . Sample of Movie struct struct Movie string title; int viewed year; int rating; Movie* nexti Sample output: Please enter the title of the movie1(within 30-character) :Dangal Please enter the year you viewed Dangal [like 2017]:2016 Please your rating for Dangal [1, 2, 3, 4, 5]:5 Please enter the title of the movie2 (within 30-character):Now You See ME Please enter the year you viewed Now You See ME [like 2017]:2013 Please your rating for Now You See ME [1, 2, 3, 4, 5]:4 Please enter the title of the movie3(within 30-character):Inception Please enter the year you viewed Inception [like 2017]:2012 Please your rating for Inception [1, 2, 3, 4, 5]:4 Movie Title Viewed Rating 1 Inception 2 Now You See ME 3 Dangal 2012 2013 2016 5 Program ended with exit code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
