#include <iostream>
using namespace std;
class Time
{public:
Time ();
friend void display();
private:
int hour,minu,sec;};
Time::Time()
{ hour=11;
minu=11;
sec=11;}
void display()
{Time t;
cout<<t.hour<<":"<<t.minu<<":"<<t.sec<<endl;}
void main()
{
display();
}
#include <iostream>
using namespace std;
class Date;
class Time
{public:
Time(int,int,int);
void display(Date &);
private:int hour,minu,sec;};
class Date
{public:
Date(int,int,int);
friend void Time::display(Date &);
private:int year,month,day;};
Time::Time(int h, int m, int s)
{hour=h; minu=m; sec=s;}
Date::Date(int y,int m,int d)
{year=y; month=m; day=d;}
void Time::display(Date &d1)
{cout<<d1.year<<"."<<d1.month<<"."<<d1.day<<endl;
cout<<hour<<":"<<minu<<":"<<sec<<endl;}
void main()
{ Time t1(23,31,24);
Date d1(2014,2,3);
t1.display(d1);
}
标签:4.13,int,void,sec,Time,Date,打卡,display From: https://www.cnblogs.com/azure011328/p/17315992.html