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

PROGRAMMING:Schedule (multiple inheritance + overload)

Luz5年前 (2021-05-10)题库476
There is already a date class date, which includes three protected member data
int year;
int month;
int day;
Another time class, time, includes three protected member data
int hour;
int minute;
int second;
Now we need to arrange the order according to the date and time of the input schedule. Therefore, we use the date class and time class as the base classes to create a schedule class, including the following new members:
int ID;// The ID of the schedule
bool operator < (const Schedule & s2);// Judge whether the current schedule time is earlier than S2
Generate the above class, and write the main function, according to the input schedule information, establish the schedule object, find out the earliest schedule, and output the information of the schedule object.
Input format: the test input contains several schedules, and each schedule occupies one line (schedule number ID, schedule date (* * / * * / * *) schedule time (* *: * *). When 0 is read in, the input ends and the corresponding result is not output.
Input example:
1 2014/06/27 08:00:01
2 2014/06/28 08:00:01
0
Output example:
The urgent schedule is No.1: 2014/6/27 8:0:1






answer:If there is no answer, please comment