• 2022-06-07
    下列程序读入时间数值,将其加1秒后输出,时间格式为:hh:m:ss,即小时:分钟:秒,当小时等于24小时,置为0。#include[br][/br]struct{[br][/br]int hour,minute,second;}time;[br][/br]int main(void){scanf("%d:%d:%d",[input=type:blank,size:4][/input])[br][/br]time.second++;[br][/br]if([input=type:blank,size:4][/input]==60){[br][/br][input=type:blank,size:4][/input];time.second =0;[br][/br]if(time.minute==60){[br][/br]time.hour++;[br][/br]time.minute =0;[br][/br]if([input=type:blank,size:4][/input])time.hour =0;}}printf("d:%d:%d \n",time.hour,time.minute,time.second )[br][/br]return 0;}[br][/br]
  • 举一反三