void ShowTime(int hr,int min,int sec) main ShowTime(9,30,0)i return 0: void ShowTime (int hr int min int sec) c吐t<(hx<10?"o″:W)<<hx<<N: (min<10?"o":"")<<min<<W: <<(sec<10?0″:W")<<sec; 09:30:00
void ShowTime(int hr,int min,int sec); main() { ShowTime(9,30,0); return 0; } void ShowTime(int hr,int min,int sec) { cout << (hr < 10 ? “0” : “”) << hr << “:” << (min < 10 ? “0” : “”) << min << “:” << (sec < 10 ? “0” : “”) << sec; } 09:30:00
struct Clock t int hour int minute int second:)i void ShowTime(const Clock&)i main o Clock myClock=[9,30,0]i ShowTime(myclock)i return 0: void ShowTime(const Clock& c) cout < (c hour <10? on: w<<chour < < (c minute 10? o: W)<< c minute < <(c. second 10? wO:N)<<c. second < endl 09:30:00
struct Clock { int hour; int minute; int second; }; void ShowTime(const Clock&); main() { Clock myClock={9,30,0}; ShowTime(myClock); return 0; } void ShowTime(const Clock& c) { cout << (c.hour < 10 ? “0” : “”) << c.hour << “:” << (c.minute < 10 ? “0” : “”) << c.minute << “:” << (c.second < 10 ? “0” : “”) << c.second << endl; } 09:30:00