Define a date class date with data members including year, month, day, setdate (int y,int m,int D), and printdate () functions for setting date and display dates, and then defining a time class, where data members include time, minutes, seconds, SetTime ( The int h,int m,int s) and the Printtime () function are used to set the time and display time respectively, on the basis of which we define a date-time class timedate, make full use of the methods provided in the existing two classes, and implement the setting and display of the date and time. Please implement Class timedate.
Code
#include <iostream> using namespace std;
Class Time {Private:int hour;
int minute;
int sec;
Public:time (int h=0,int m=0,int s=0): Hour (h), Minute (m), SEC (s) {} void settime (int h,int m,int s);
void Printtime ();
};
void time::settime (int h,int m,int s) {hour=h;
Minute=m;
Sec=s;
} void Time::P rinttime () {cout<
Run Result: