CodePudding user response:
Base 60 algorithm, primary school,When it is not difficult to be without invoking ready-made functions, write their own
CodePudding user response:
EssayInt a, b, c, d, e, f; Char aa, bb,
Cin> a> Aa> b> Bb> C; 11:20:15
Cin> D> Aa> E> Bb> f; 11:25:12
If (f
Int main (int arg c, char * * argv)
{
Int sHour sMin, but a eHour, eMin, eSec;
The scanf (" % d: % d: % d % d: % d: % d ", & amp; SHour, & amp; SMin, & amp; But, & amp; EHour, & amp; EMin, & amp; ESec);
//computing time difference
Int iPtTime=(3600 + eMin eHour * * 60 + eSec) - (3600 + sMin sHour * * 60 + but);
//the next day special cases
If (iPtTime<0)
IPtTime +=60 * 60 * 24;
//conversion
Int hour=iPtTime/3600;
Int min=(iPtTime - hour * 3600)/60;
Int the SEC=(iPtTime - hour * 3600) % 60;
02 printf (" % d: % d: % 2 d \ n ", hour, min, SEC);
return 0;
}