Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using this function write a C++ program ** FUNCTION int minutes_since_midnight(i

ID: 3758447 • Letter: U

Question

Using this function write a C++ program

** FUNCTION

int minutes_since_midnight(int hours, int minutes, bool isAM)
{
using namespace std;

// Convert 12AM (midnight) to hour '0'
if ((hours == 12) && (isAM))
{
hours = 0;
}

// Add 12 to hours after noon
if ((hours < 12) && (! isAM))
{
hours += 12;
}

return minutes + (hours * MINUTES_IN_HOUR);
}

That has this output:

SAMPLE OUTPUT

Enter start time, in the format 'HH:MM xm', where 'xm' is
either 'am' or 'pm' for AM or PM: 12:05 am

Enter future time in the format 'HH:MM xm' where 'xm' is
either 'am' or 'pm': 12:15 am

There are 10 minutes (0 hours and 10 minutes) between 12:05 AM and 12:15AM.

Another go for the time machine? Type 1 for a go and any other number of a no go=>1

Enter start time, in the format 'HH:MM xm', where 'xm' is
either 'am' or 'pm' for AM or PM: 12:58 am

Enter future time in the format 'HH:MM xm' where 'xm' is
either 'am' or 'pm': 12:59 pm

There are 721 minutes (12 hours and 1 minute) between 12:58 AM and 12:59PM.

Another go for the time machine? Type 1 for a go and any other number of a no go=>1

Enter start time, in the format 'HH:MM xm', where 'xm' is
either 'am' or 'pm' for AM or PM: 4:50 pm

Enter future time in the format 'HH:MM xm' where 'xm' is
either 'am' or 'pm': 6:30 am

There are 820 minutes (13 hours and 40 minutes) between 4:50 PM and 6:30AM.

Another go for the time machine? Type 1 for a go and any other number of a no go=>2

Explanation / Answer

The value returned is expressed in clock ticks, which are units of time of a constant but system-specific length (with a relation of CLOCKS_PER_SEC clock ticks per second).

The epoch used as reference by clock varies between systems, but it is related to the program execution (generally its launch). To calculate the actual processing time of a program, the value returned by clock shall be compared to a value returned by a previous call to the same function.

}