⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c++2.txt

📁 一个实验
💻 TXT
字号:
#include<iostream.h>
class Date
{
public:
	Date();
	Date(int,int,char);
	Date(Date&);
	void GetYear( );
	void GetMonth( );
	void  GetDay( );
private:
	int year;
	int month;
	char day;
};

Date::Date(int a,int b,char c)
{year=a;
month=b;
day=c;
}

Date::Date()
{
year=2001;
month=2;
day=5;
}

Date::Date(Date & dtmp)
{year=dtmp.year;
month=dtmp.month;
day=dtmp.day;
}


void Date::GetYear()
{cout<<" The Year is: "<<year<<endl;}

void Date::GetMonth()
{cout<<" The Month is: "<<month<<endl;}

void Date::GetDay()
{cout<<" The Day is: "<<day<<endl;}

void main()
{
Date d1(2001,5,8);
d1.GetYear()
d1.GetMonth()
d1.GetDay()
Date d2;
d2.GetYear()
d2.GetMonth()
d2.GetDay()
Date d3(d1);
d3.GetYear()
d3.GetMonth()
d3.GetDay()
}

⌨️ 快捷键说明

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