bool operator!=(const Clock a, const Clock b) { if (a.getHour() == b.getHour() && a.getMin() == b.getMin() && a.getSec() == b.getSec()) { return false; } else {return true;} }
Clock operator+(Clock a, const Clock b) { a.setHour(a.getHour() + b.getHour()); a.setMin(a.getMin() + b.getMin()); a.setSec(a.getSec() + b.getSec()); while(a.getSec() >= 60) { a.setMin(a.getMin()+1); a.setSec(a.getSec()-60); } while(a.getMin() >= 60) { a.setHour(a.getHour()+1); a.setMin(a.getMin()-60); } while(a.getHour() >= 24) { a.setHour(a.getHour()-24); } return a; }
Clock operator-(Clock a, const Clock b) { a.setHour(a.getHour() - b.getHour()); a.setMin(a.getMin() - b.getMin()); a.setSec(a.getSec() - b.getSec()); while(a.getSec() < 0) { a.setMin(a.getMin()-1); a.setSec(a.getSec()+60); } while(a.getMin() < 0) { a.setHour(a.getHour()-1); a.setMin(a.getMin()+60); } while(a.getHour() < 0 ) { a.setHour(a.getHour()+24); } return a; }