-->
当前位置:首页 > 题库

PROGRAMMING:Time conversion

Luz5年前 (2021-05-10)题库442
Define a time class time with data members hour, minute, second and other member functions: constructor is used to initialize data members, output functions, operator overload + (plus sign),. Write the main function: create a time object, and then enter the number of seconds n, through the operator overload + (minus sign), calculate the time value after N seconds, the time expression is: Minutes: seconds, more than 24 hours from 0 to start timing again.
The test input contains several test cases, and each test case occupies one line. When 0 is read in, the input ends and the corresponding result is not output.
   
Input and output example: description in brackets
   0 0 1 59 ( Time is 0:0:1, seconds n = 59)
   11 59 40 30 ( Time is 11:59:40, number of seconds n = 30)
   23 59 40 3011 ( Time is 23:59:40, seconds n = 3011)
   0 0 0 0
Output:
time:0 :1:0 ↙( 0:0:01 plus 59 seconds)
time:12 :0:10 ↙( 11: 59:40 plus 30 seconds of new time)
time:0 :49:51 ↙( 23:59:40 plus new time of 3011 seconds) < br > < br > < br > < br > < br > < br >


answer:If there is no answer, please comment