Class Time
{
private:
int hours, minutes, seconds;
public:
Time() {
hours = minutes = seconds = 0;
}
Time(int hours) {
this->hours = hours % 24;
minutes = seconds = 0;
}
Time(int hours, int minutes) {
this->hours = (hours + minutes / 60) % 24;
this->minutes = minutes % 60;
seconds = 0;
}
Time(int hours, int minutes, int seconds) {
this->hours = (hours + minutes / 60 + seconds / 3600) % 24;
this->minutes = (minutes + seconds / 60) % 60;
this->seconds = seconds % 60;
}
void next() {
++this->seconds;
if (this->seconds == 60) {
this->seconds = 0;
++this->minutes;
if (this->minutes == 60) {
++this->hours;
if (this->hours == 24) {
this->hours = 0;
}
}
}
}
int get_seconds() {
return this->seconds;
}
int get_minutes() {
return this->minutes;
}
int get_hours() {
return this->hours;
}
};