#include<iostream>
#include<cstdio>
using namespace std;
class Date{
public:
Date(int y=0,int m=0,int d=0):year(y),month(m),day(d){}
void SetDate(int y,int m,int d){
year=y;
month=m;
day=d;
}
void PrintDate();
private:
int year,month,day;
};
void Date::PrintDate(){
cout<<year<<" "<<month<<" "<<day<<" ";
}
class Time{
public:
Time(int h=0,int m=0,int s=0):hour(h),minute(m),second(s){}
void SetTime(int h,int m,int s);
void PrintTime();
private:
int hour;
int minute;
int second;
};
void Time::SetTime(int h,int m,int s){
hour=h;
minute=m;
second=s;
}
void Time::PrintTime(){
cout<<hour<<" "<<minute<<" "<<second<<" ";
}
class TimeDate:public Date,public Time
{
public:
TimeDate(int y,int m,int d,int h,int n,int s):Date(y,m,d),Time(h,n,s){}
void PrintTimeDate();
};
void TimeDate::PrintTimeDate(){
PrintDate();
PrintTime();
}
int main()
{
freopen("input.txt","r",stdin); //只加这一句输入将被重定向到文件input.txt
int a,b,c,d,e,f;
cin>>a>>b>>c>>d>>e>>f;
TimeDate num(a,b,c,d,e,f);
num.PrintTimeDate();
cout<<endl;
return 0;
}
13周项目4
最新推荐文章于 2024-06-24 23:55:59 发布