Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The file movies.txt contains a list of movies. Assume the input file contains at least 1 movie, and at most 1000 movies. Parts of the

image text in transcribedThe file movies.txt contains a list of movies. Assume the input file contains at least 1 movie, and at most 1000 movies.
Parts of the code written:
string moviename;
getline(file, moviename);
while (!file.eof())
{
.
.
.
getline(file, moviename);
}
Write the complete program to get the output in the picture.
The lab exercise is a simple one: input movie names from a file, and output the total # of movies, the first movie, and the last movie. The input file contains the movie names, one per linethere is nothing special at the end. Example: suppose the file "movies.txt" contains The Shawshank Redemption (1994) The Godfather (1972) The Godfather: Part II (1974) Pulp Fiction (1994) The Good the Bad and the Ugly (1966) The Dark Knight (2008) 12 Angry Men (1957) Schindler's List (1993) The Lord of the Rings: The Return of the King (2003) Fight Club (1999) Your program should input the name of the file from the keyboard: movies.txt The output from your program should be the # of movies, first movie name, and last movie name: 10 The Shawshank Redemption (1994) Fight Club (1999)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

LO2 Explain the nature of the psychological contract.

Answered: 1 week ago