![joshuajoseph249](/avatars/40717.jpg)
joshuajoseph249
20.03.2020 •
Computers and Technology
Write a function to prompt the user to enter the information for one movie (title, release date, mpaa rating and number of stars). This function should then return the movie information back to main. You should call this function twice, once for each of the MovieInfo variables in main.
Solved
Show answers
More tips
- D Dating, Love, Relationships Why Should the Man be Active and the Woman Passive during Foreplay?...
- F Food and Cooking How to Properly Collect Mushrooms? A Comprehensive Guide...
- C Computers and Internet 3D Glasses! What is this thing?...
- C Computers and Internet How to insert videos into LiveJournal?...
- C Computers and Internet How Much Does an iPhone Cost in America?...
- F Family and Home How to Choose the Best Diapers for Your Baby?...
- F Family and Home Parquet or laminate, which is better?...
- L Leisure and Entertainment How to Properly Wind Fishing Line onto a Reel?...
- L Leisure and Entertainment How to Make a Paper Boat in Simple Steps...
- T Travel and tourism Maldives Adventures: What is the Best Season to Visit the Luxurious Beaches?...
Answers on questions: Computers and Technology
- C Computers and Technology Which of the following is an object-oriented programming language? - Ada - COBOL - Pascal - Python...
- C Computers and Technology Create a function named CountVowels() that takes one parameter name epsilon (in the function) Create a variable name countNum and set it to zero Create a for loop...
- C Computers and Technology Float_abs - return bit-level equivalent of absolute value of f for * floating point argument f. * both the argument and result are passed as unsigned int s, but *...
- C Computers and Technology How can i appear offline without fb messenger saying last active 1 minute ago ?...
- L Law What is classical criminology...
- M Mathematics Jackson goes to the gym 1, 2 or 3 days in a week, depending on work demands at the office. The probability that he goes 1 day is 0.1, the probability that he goes...
- H History What was a result of the United States’ confusing and unclear war strategy in the 1970s? Public opinion about the war continued to decline. South Vietnam gained ground...
- M Mathematics To find the surface area of the figure shown, Mia found the surface area of the two triangular prisms and the rectangular prism. From this, Mia subtracted 6 ft? Did...
- M Mathematics A cylinder has a volume of What is the volume of a cone with the same diameter and height as the cylinder?...
- H History In September 1864, General William Tecumseh Sherman and 10,000 Union soldiers captured Richmond, the Confederacy s capital. A)True B)False...
Ответ:
Complete code is given and the output is attached also
Explanation:
#include <iostream>
#include <iomanip>
#include <list>
#include <iterator>
using namespace std;
/*
1. You will need to create a structure named MovieInfo that contains the following information about a movie:
title (string) - title of the movie
release date (string)
mpaa rating (string) - G, PG13, PG, R, NC17
number of stars (double) - out of 5
*/
struct MovieInfo
{
string title; //- title of the movie
string releaseDate ; //
string mpaaRating; // rating - G, PG13, PG, R, NC17
double numberOfStars; // of stars (1 out of 5)
};
/*
3. Write a function to prompt the user to enter the information for one movie (title, release date, mpaa rating and number of stars). This function should then return the movie information back to main. You should call this function twice, once for each of the MovieInfo variables in main.
Note: After you read the number of stars, you will need to use cin.get() or cin.ignore() to get rid of the end of line character prior to the next call to getline in your program
cout << "Enter the number of stars the movie received : ";
cin >> movie.numberOfStars;
cin.get();
*/
MovieInfo promptForMovieInformationAndReturn(){
MovieInfo movie;
cout<<"Enter the title of movie : ";
getline (cin,movie.title);
cout<<"Enter the release date of movie : ";
getline (cin,movie.releaseDate);
cout<<"Enter the mpaa rating of movie : ";
getline (cin,movie.mpaaRating);
cout << "Enter the number of stars the movie received : ";
cin >> movie.numberOfStars;
cin.get();
cout<<endl;
return movie;
}
/*
4. Write a function to display a list of movie recommendations that contains only the movies with 4 or more stars. The list of recommendations should include:
a title - Movie Recommendations
movie name
number of stars (formatted so you have 1 place after the decimal point)
You will need to use an if .. else if statement to display either both movies, one movie, or a message that you have no recommendations.
*/
void displayListOfMovieRecommendations(list<MovieInfo> movies){
list <MovieInfo> :: iterator it;
cout<<setw(16)<<left<<"*******************************"<<endl;
cout<<setw(16)<<left<<" Movie Recommendations "<<endl;
cout<<setw(16)<<left<<"*******************************"<<endl;
for(it = movies.begin(); it != movies.end(); ++it) {
if(it->numberOfStars >= 4 ){
cout <<setw(16)<<left<< it->title<<setw(16)<<left<<setprecision(2)<< it-> numberOfStars <<endl;
}
}
}
int main() {
/*
2. The main program will create two MovieInfo variables, for example movie1 and movie2.
*/
MovieInfo movie1;
MovieInfo movie2;
movie1 = promptForMovieInformationAndReturn();
movie2 = promptForMovieInformationAndReturn();
list <MovieInfo> movies;
movies.push_back(movie1);
movies.push_back(movie2);
displayListOfMovieRecommendations(movies);
}
Ответ:
It does not have the () by the tacos I think with a educated guess.
hope this helped!
Explanation: