return *this;
}
+hour hour::increase()
+{
+ seconds ++;
+ if (seconds >= 60)
+ {
+ minutes++;
+ seconds -= 60;
+ }
+ if (minutes >= 60)
+ {
+ hours++;
+ minutes -= 60;
+ }
+
+ return *this;
+}
+
hour operator-(hour &t1, hour &t2)
{
hour t = t1;
return t;
}
+hour hour::operator-=(hour t)
+{
+ seconds -= t.seconds;
+ if (seconds < 0)
+ {
+ minutes--;
+ seconds += 60;
+ }
+
+ minutes -= t.minutes;
+ if (minutes < 0)
+ {
+ hours--;
+ minutes += 60;
+ }
+
+ hours -= t.hours;
+
+ return *this;
+}
+
+hour hour::decrease()
+{
+ seconds --;
+ if (seconds < 0)
+ {
+ minutes--;
+ seconds += 60;
+ }
+
+ if (minutes < 0)
+ {
+ hours--;
+ minutes += 60;
+ }
+
+ return *this;
+}
+
std::ostream& operator<<(std::ostream &s, const hour &t)
{
s.width(2);