Page 1 of 1

Your Program Write a program that reads information about movies from a file named movies.txt. Each line of this file co

Posted: Sun May 15, 2022 12:47 pm
by answerhappygod
Your Program Write A Program That Reads Information About Movies From A File Named Movies Txt Each Line Of This File Co 1
Your Program Write A Program That Reads Information About Movies From A File Named Movies Txt Each Line Of This File Co 1 (177.24 KiB) Viewed 60 times
Your Program Write A Program That Reads Information About Movies From A File Named Movies Txt Each Line Of This File Co 2
Your Program Write A Program That Reads Information About Movies From A File Named Movies Txt Each Line Of This File Co 2 (63.85 KiB) Viewed 60 times
HarryPotterAndTheDeathlyHallowsPartI 2010 283533215
Inception 2010 292568851
Avatar 2010 408392727
AliceInWonderland 2010 334191110
TheTwilightSagaEclipse 2010 300531751
HowToTrainYourDragon 2010 217581231
DespicableMe 2010 251203225
ShrekForeverAfter 2010 238736787
ToyStory3 2010 415004880
IronMan2 2010 312433331
StarWars:TheForceAwakens 2015 2068223624
JurassicWorld 2015 1670400637
Furious7 2015 1516045911
Avengers:AgeofUltron 2015 1405413868
Minions 2015 1159398397
Spectre 2015 880674609
InsideOut 2015 857611174
Mission:ImpossibleñRogueNation 2015 682330139
TheHungerGames:Mockingjay 2015 653428261
TheMartian 2015 630161890
main.cpp:
#include<iostream>
#include<iomanip>
#include<fstream>
#include<string>
using namespace std;
const int MOVIES_SIZE = 20;
// Declare a struct named Movie with 3 members for:
// title, year released, and revenue
// Enter here your function prototypes
// main() starts here
// Declare file variable
// Open file Movies.txt
// Check if file was opened
// Declare array of movies
// Declare auxiliary variables
// Read the information from the movies file
and store it in the array
// Sort the array by the movie title so the
binary search can be used
// Start the loop
// Clear the screen

// Print the movies array
// Ask the user to input a
title
// Find the index of the
movie that the user chooses
// If the movie was not
found
//
Print the message indicating the title was
not found
// Otherwise
//
Print the information about the chosen
movie
// Ask the user "Do you
want to continue? (y/n): "
// Get the answer
// Continue looping while the answer is
'y'
// Close the file
// main() ends here
// Function definitions start here
storeMoviesArray(ifstream inFile, Movies topMovies[], const int
SIZE)
// This function receives the input file, the movies array, and the
size of the
// array.
// It reads from the file the movie data and stores it in the
array.
// Once all the data has been read in, it returns the array with
the information
// of the movies.
sortMoviesTitle(Movie topMovies[], const int SIZE)
// This function receives the movies array and the size of the
array and sorts
// the array by title. It returns the sorted array.
printMoviesArray(Movie topMovies[], const int SIZE)
// This function receives the movies array and the size of the
array and prints
// the list of movies.
findMovieTitle(Movie topMovies[], const int SIZE, string
title)
// This function receives the movies array, the size of the array,
and the title
// of the movie to be searched for.
// It returns the index of the array where the title was found. If
the title was
// not found, it returns -1. It must use BINARY SEARCH to find the
movie.
Your Program Write a program that reads information about movies from a file named movies.txt. Each line of this file contains the name of a movie, the year the movie was released, and the revenue for that movie. Your program reads this file and stores the movie data into a list of movies. It then sorts the movies by title and prints the sorted list. Finally, your program asks the user to input a title and the program searches the list of movies and prints the information about that movie. To represent the movie data you have to create a struct named Movie with three members: title, yearReleased, and revenue. To handle the list of movies you have to create an array of Movie structs named topMovies capable of storing up to 20 movies. Your solution must be implemented using the following functions: storeMoviesArray(ifstream inFile, Movies topMovies[], const int SIZE) // This function receives the input file, the movies array, and the size of the // array. // It reads from the file the movie data and stores it in the array. // Once all the data has been read in, it returns the array with the information // of the movies. sortMoviesTitle(Movie topMovies[], const int SIZE) // This function receives the movies array and the size of the array and sorts // the array by title. It returns the sorted array. printMoviesArray(Movie topMovies[], const int SIZE) // This function receives the movies array and the size of the array and prints // the list of movies.

find MovieTitle(Movie topMovies[],const int SIZE, string title) // This function receives the movies array, the size of the array, and the title // of the movie to be searched for. // It returns the index of the array where the title was found. If the title was // not found, it returns - 1. It must use binary search to find the movie. main() // Takes care of the file (opens and closes it). // Calls the functions and asks whether to continue.