main.cpp

来自「this a good book.」· C++ 代码 · 共 59 行

CPP
59
字号
#include <iostream>
using namespace std;

class Time;
class Date
{
public:
	Date(int y=2005,int m=1,int d=1)
	{
		year = y;
		month= m;
		day  = d;
	}
	//* * 1 * *
	
	//* * 2 * *
	
private:
	int year,month,day;
};

class Time
{
public:
	Time(int h=0,int m=0,int s=0)
	{
		hour = h;
		minute=m;
		second=s;
	}
	//* * 2 * *
	
	//* * 3 * *
	
private:
	int hour,minute,second;
};


void Date::DateTime(Time& t)
{
	//* * 4 * *
	
}

void DateTime(Date& d,Time& t)
{
	cout<<"Now is "<<d.year<<"."<<d.month<<','<<d.day<<' '<<t.hour<<':'<<t.minute
		<<':'<<t.second<<endl;
}

void main()
{
	Date d;
	Time t(10,10,10);

	d.DateTime(t);
	DateTime(d,t);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?