#include #include using namespace std; class Time { public: void setTime(); void showTime(); int hour, minute, sec; }; void Time::setTime() { cin>>hour>>minute>>sec; } void Time::showTime() { if(hour>24||minute>60||sec>60) { cout<<"input error, plz input again"; return; } cout << setw(2) << right << setfill('0') << hour<<":"; cout << setw(2) << right << setfill('0') << minute<<":"; cout << setw(2) << right << setfill('0') << sec; } int main() { Time t; t.setTime(); t.showTime(); return 0; }