Question: Create a new file called conflict.cpp . In this file, write a program that asks the user for the start and end times of two

Create a new file called conflict.cpp. In this file, write a program that asks the user for the start and end times of two classes. It then prints the times that it receives, and tells the user whether or not the two classes conflict.
The user will enter all times as they would appear on a 24-hour digital clock: 1:00 PM would be entered as 13:00. If the classes overlap at all, your program should report a conflict by printing Conflict! Otherwise, print No conflict. Two classes must overlap for at least one minute in order to conflict: a class that ends at 15:00 doesn't conflict with a class that starts at 15:00.
The user will always input an integer followed by a non-digit character followed by another integer. The integers may or may not contain leading zeros: 09:7 should be read the same as 9:07. The time entered may not be valid; a time is invalid if:
The hour is not between 0 and 23(inclusive).
The minute is not between 0 and 59(inclusive).
The separator is not a colon (:, ASCII code 0x3a).
If the user enters an invalid time, your program should say so and prompt again. This could happen at any of the four time prompts.
The user might also enter an end time that isn't later than the start time. In this case, your program should note the error and have the user re-enter both times. This could happen for either of the classes.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!