Hi team,
I need to create a program that firstly accepts entries from the user in the following format hh mm ss two times, then the program converts these entries into seconds and must test which of the two times is higher so that it subtracts the two correctly. i was able to do this),
At this point i have the difference between the two times in seconds, how do I now format these seconds to again appear as hh:mm:ss?
I have the below code but it doesn't seem to be converting my seconds to the required format...... Please help me with this
if (_1hr > _2hr)
{
TotalSecs = _1ConvertedSecs - _2Convertedsecs;
NewTime = TotalSecs %T;
cout << "The total seconds after we have subtracted the second time entered from the first time entered (1st time - 2nd time) is " <<
TotalSecs << endl;
cout << "Which means that the time is " << NewTime << endl;
}
else
{
TotalSecs = _2Convertedsecs - _1ConvertedSecs;
NewTime = TotalSecs %T;
cout << "The total seconds after we have subtracted the first time entered from the Second time entered (2nd time - 1st time) is " <<
TotalSecs << endl;
cout << "Which means that the time is " << NewTime << endl;
}