#include <iostream>
using namespace std;
class Date;
class Time
{
public:
Time(int ,int ,int );
friend void display(const Date &,const Time &);
private:
int hour;
int minute;
int sec;
};
Time::Time(int h,int m,int s)
{
hour=h;
minute=m;
sec=s;
}
class Date
{
public:
Date(int ,int ,int );
friend void display(const Date &,const Time &);
private:
int day;
int month;
int year;
};
Date::Date(int d,int m,int y)
{
day=d;
month=m;
year=y;
}
void display(const Date &d,const Time &t)
{
cout<<d.day<<" "<<d.month<<" "<<d.year<<endl;
cout<<t.hour<<" "<<t.minute<<" "<<t.sec<<endl;
}
int main()
{
Time t(10,13,56);
Date d(10,25,2004);
display(d,t);
return 0;
}
3.10
最新推荐文章于 2024-09-20 14:48:27 发布