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

PROGRAMMING:Using class to realize input and output time

Luz5年前 (2021-05-10)题库399
The results are as follows:
First input the time of time object T1 (hour, minute and second)
Re input the time of time object T2 (hours, minutes and seconds)
###Input format:
Hours, minutes and seconds
Hours, minutes and seconds
###Output format:
t1 is:
Hours: Minutes: seconds
t2 is:
Hours: Minutes: seconds
###Input example:
Here is a set of inputs. For example:
```in
10 30 0
12 10 0
```
###Output example:
The corresponding output is given here. For example:
```out
t1 is:
10:30:0
t2 is:
12:10:0
```







answer:If there is no answer, please comment
This problem requires the preparation of a time class, which declares the following members:
Private: variable member (integer: hour, minute, SEC)
public:
//Set time
void set_ time(int iHour,int iMinute, int iSec)
//Display time
void show_ time( )
Main function: two time objects are required to be created to input and display time respectively. The format is as follows:
input
10 30 0
12 10 0
output
t1 is:
10:30:0
t2 is:
12:10:0