Your solution will entail writing a function called TimeDifference and a test main that demonstrates that you can compute the time difference in minutes between the two times.
TimeDifference is a function that receives a start time and end time that are structs of your creation.
You need to compute the difference in minutes between the start time and end time, returning the number of minutes to your test main.
If the end time is less than the start time it means we have rolled over by a single day and you will need to correct the difference to accommodate the time rollover. Time will be in 24 hour format, rather than AM and PM.
This is easier than you might think. What would happen if you determined the start and end times in total minutes? If you subtracted the start total minutes from the end total minutes, wouldn't you have the difference in minutes?
If the result was less than zero, wouldn't it mean that you have rolled over a day and need to add the total minutes in a day to the difference you computed to get the correct answer? Of course, you can use any other strategy you want!
Your Test Main must:
1. Create two variables of a structure (using the typedef). I named mine TheStart and TheEnd)
TheStart contains 11 hours, 52 minutes
TheEnd contains 14 hours, 43 minutes
2. Print out the contents of TheStart and TheEnd
3. Call TimeDifference (TheStart, TheEnd). On return, print out the number of minutes.
4. Call TimeDifference (TheEnd, TheStart). On return, print out the number of minutes.
For your convenience, here is the output of my program:
TheStart is HH:11 MM:52
TheEnd is HH:14 MM:43 time from TheStart to TheEnd is : 171
time from TheEnd to TheStart is : 1269
Notes: 1. There is no printing anywhere but from your main().
2. You must submit the code and the output from program execution.