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

📄 c++实验2.txt

📁 数据结构课堂实验 集中了数据结构,线性表,连表,栈,队列,二叉树,图,排序算法,查找算法的实现
💻 TXT
字号:
#include<iostream.h>
class Date
{
public:
	Date();
	Date(int,int,int);
	Date(Date&);
	void GetYear( );
	void GetMonth( );
	void  GetDay( );
private:
	int year;
	int month;
	int day;
};

Date::Date(int a,int b,int 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 + -