#include <iostream>
using namespace std;
struct Time {
int hours;
int minutes;
int seconds;
};
void difference(Time t1, Time t2, Time *diff);
int main() {
Time t1, t2, diff;
cout << "Enter start time." << endl;
cout << "Hours: "; cin >> t1.hours;
cout << "Minutes: "; cin >> t1.minutes;
cout << "Seconds: "; cin >> t1.seconds;
cout << endl << "Enter end time." << endl;
cout << "Hours: "; cin >> t2.hours;
cout << "Minutes: "; cin >> t2.minutes;
cout << "Seconds: "; cin >> t2.seconds;
difference(t1, t2, &diff);
cout << endl << "Time difference: " << diff.hours << " hours, "
<< diff.minutes << " minutes, " << diff.seconds << " seconds.";
return 0;
}
void difference(Time t1, Time t2, Time *diff) {
if (t2.seconds > t1.seconds) {
--t1.minutes;
t1.seconds += 60;
}
diff->seconds = t1.seconds - t2.seconds;
if (t2.minutes > t1.minutes) {
--t1.hours;
t1.minutes += 60;
}
diff->minutes = t1.minutes - t2.minutes;
diff->hours = t1.hours - t2.hours;
}