Question: Write iN C please Write a program elapsed_time that takes as its arguments two time structures and returns a time structure that represents the elapsed
Write iN C please
Write a program elapsed_time that takes as its arguments two time structures and returns a time structure that represents the elapsed time (in hours, minutes, and seconds) between the two times. So, the call
elapsed_time (time1, time2)
where time1 represents 3:45:15 and time2 represents 9:44:03, should return a time structure that represents 5 hours, 58 minutes, and 48 seconds. Be careful with times that cross midnight.
A sample main program is provided below for your reference:
int main (void)
{
struct time elapsed_time (struct time t1, struct time t2);
struct time t1 = {3, 45, 15 }, t2 = { 9, 44, 03 },
struct time result;
result = elapsed_time (t1, t2);
printf ("Time between %.2i:%.2i:%.2i and %.2i:%.2i:%.2i " "is %.2i:%.2i:%.2i ",
t1.hour, t1.minutes, t1.seconds, t2.hour, t2.minutes, t2.seconds, result.hour, result.minutes, result.seconds);
Sample Output:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
