// 22.5HV2 Software Engineering II // Unit 4 Exercise 4 #include #include #include "clock.h" Clock::Clock(int h=0, int m=0, int s=0): hour(h), minute(m), second(s) {} void Clock::tick() { minute += (second+1)/60; hour += minute/60; minute %= 60; hour %= 24; second = (second+1)%60; } void Clock::show_time() { cout << setfill('0') << setw(2) << hour; cout << ":" << setw(2) << minute << ":" << setw(2) << second << endl; }