/* 3. Write a function 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. */
// What I have so far #include <stdio.h> #include <stdbool.h> struct time // define structure { int hour; int minute; int second; } void elapsed_time(struct time1, str
void elapsed_time(struct time1, struct time2, struct elapsed); // arguments are 2 time structures int main(void) { struct time time1, time2; printf ("Enter starting time (HH MM SS): "); scanf ("%i%i%i". &time.hour, &time.minute, &time.second);
Can you use time.h? If you can, check out the man page for ctime.
I dont think we can use any other header files. I am going to look in to this tho, thanks for the response.
Join our real-time social learning platform and learn together with your friends!