You are on page 1of 1

LAB 3-1

CSC404 PROGRAMMING II
CHAPTER 3: ONE-DIMENSIONAL ARRAY (RECAP)
QUESTION 1
Given below is the list of new movies at TGV Cinema:

Write a C++ program to perform the following tasks:

• Declare and initialize an array named movieTitle to store the titles of six new movies.
• Declare and initialize an array named duration to store the running times of six new
movies.
• Find and display which movie title has the longest running time.
• Search the movie entitled “Dilwale”. If the movie title is found, stop the searching process.
Then, replace the title with a new title “Mr. Unbelievable” with its running time 94 minutes.
Display appropriate message if the movie title is not found in the array.
• Find and display the titles and the number of the movies that their running times are longer
than two hours.
• Sort and display the movie ascending order i.e. from longest to shortest running time. Below
is the sample output:

The movie list from longest to shortest running time:


Dilwale 155
Langit Cinta 120
Intruders 112
Friend Request 100
The Forest 95
Mat Moto: Kami Mat Moto Bukan Mat Rempit 90

You might also like