Question: Hi there, Please solve below question using C++ programming language. 4.18 Custom Lab: Branches**: Enumeration with if-else 24-hour time (also known in the U.S. as

Hi there,

Please solve below question using C++ programming language.

Hi there, Please solve below question using C++ programming language. 4.18 Custom

4.18 Custom Lab: Branches**: Enumeration with if-else 24-hour time (also known in the U.S. as military time) is widely used around the world. Time is expressed as hours since midnight. The day starts at 00:00, and ends at 23:59. Write a program that converts am/pm time to 24 -hour time. The input is two numbers and a string. If the input is 230pm, the output should be 14:30. If the input is 1201am, the output should be 00:01. Hints: - Think of how each hour should be handled. 1200 am -12 59 am becomes what? 800 am becomes what? 1200pm ? 100pm ? Group the hours into cases that should be handled similarly (e.g., 100 am to 1100 am are handled the same). - Declare variables for hoursAmPm, minAmPm, and hours24. Note that minutes for 24 -hour time remain the same as for am/pm, so no extra variable is needed. - Use an if-else statement to detect each case, and set the hours 24 appropriately. - When outputting hour24, check if the hour is 09 (just check for

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!