Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C++ program called hw4_2.cpp that reads a set of events and displays the maximum number of events that take place concurrently. Input format:
Write a C++ program called hw4_2.cpp that reads a set of events and displays the maximum number of events that take place concurrently. Input format: This is a sample input from a user. 5 7 12 10 14 8 11 12 15 16 20 The first number (= 5 in the example) indicates that there will be five events in a convention center. All numbers from the second line to the last line are event hours. For example, the first event starts at 7:00(AM) and ends at noon (= 12:00(PM)). The second event starts at 10:00(AM) and ends at 2:00(PM). The last event starts at 4:00(PM) and ends at 8:00(PM). Sample Run 0: Assume that the user typed the following lines 5 7 12 10 14 8 11 12 151 16 20 This is the correct output of your program. Max events: 3 Note that there will be three events from 10:00(AM) to 11:00(AM). Also, there will be three events at 12:00(PM). So, the maximum number of events that take place concurrently should be 3. Sample Run 1: Assume that the user typed the following lines 10 13 14 1 2 15 16 17 18 78 9 10 5 6 11 12 19 20 3 4 This is the correct output of your program. Max events: 1 Sample Run 2: Assume that the user typed the following lines 7 10 14 19 20 12 18 0 24 7 8 7 13 19 20 This is the correct output of your program. Max events: 4 Sample Run 3: Assume that the user typed the following lines 4 10 15 17 18 12 13 16 23 This is the correct output of your program. Max events: 2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started