• 2022-06-07
    下列程序读入时间数值,将其加1秒后输出,时间格式为:hh: mm: ss,即“小时:分钟:秒”,当小时等于24小时,置为0。 #include struct { int hour, minute, second; } time; int main(void) { scanf("%d:%d:%d",___________); time.second++; if(___(2)_______ == 60) { ____(3)__________ ; time.second = 0; if(time.minute == 60) { time.hour++; time.minute = 0; if(_____(4)_________) time.hour = 0; } } printf ("%d:%d:%d ", time.hour, time.minute, time.second ); return 0; }
  • 举一反三