#include?<vector>
class?Ctime?{
private:
std::vector<int>?_val;
const?static?int?_is60?=?60;
std::vector<int>&?calc_clock(?const?int&?v,?const?int?opt?=?0?)?{
int?res?=?v?+?opt;
_val.push_back(?res?%?_is60?);
_val.push_back(?(res/_is60)?%?_is60?);
_val.push_back(?(?res?-?_val[1]*_is60?-?_val[0]?)?/?(_is60*_is60)?);
return?_val;
}?
public:
Ctime?(?const?int&?v,?const?int?opt?=?0?)?{
calc_clock(?v,?opt?);
}
friend?std::ostream&?operator<<?(?std::ostream&?out,?const?Ctime&?clock?)?{
out?<<?clock._val[2]?<<?"?:?";
out?<<?clock._val[1]?<<?"?:?";
out?<<?clock._val[0];
return?out;
}
};
int?main(?)?{
Ctime?t1(?3661?);
Ctime?t2(?3661,?-8?);
Ctime?t3(?3661,?8?);
//
std::cout?<<?t1?<<?std::endl;
std::cout?<<?t2?<<?std::endl;
std::cout?<<?t3?<<?std::endl;
}