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 hour digital clock: : PM would be entered as : 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 : doesn't conflict with a class that starts at :
The user will always input an integer followed by a nondigit character followed by another integer. The integers may or may not contain leading zeros: : should be read the same as : The time entered may not be valid; a time is invalid if:
The hour is not between and inclusive
The minute is not between and inclusive
The separator is not a colon : ASCII code xa
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 reenter 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
