This commit is contained in:
		
						commit
						8218957b02
					
				
							
								
								
									
										179
									
								
								Linux/Date.cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										179
									
								
								Linux/Date.cc
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,179 @@ | ||||
| #include "Date.hpp" | ||||
| using namespace Lenyiin; | ||||
| 
 | ||||
| // 测试构造析构函数
 | ||||
| void TestDate_1() | ||||
| { | ||||
|     // 默认无参构造
 | ||||
|     Date d1; | ||||
|     // 默认有参构造
 | ||||
|     Date d2(2024, 9, 1); | ||||
|     // 拷贝构造
 | ||||
|     Date d3(d2); | ||||
| 
 | ||||
|     // 测试输出功能
 | ||||
|     std::cout << "d1 为 " << d1 << std::endl; | ||||
|     std::cout << "d2 为 " << d2 << std::endl; | ||||
|     std::cout << "d3 为 " << d3 << std::endl; | ||||
| 
 | ||||
|     // 赋值拷贝
 | ||||
|     d1 = d3; | ||||
|     std::cout << "d1 为" << d1 << std::endl; | ||||
| 
 | ||||
|     // 测试闰年闰月
 | ||||
|     Date d4(2008, 2, 29); | ||||
|     std::cout << "d4 为" << d4 << std::endl; | ||||
| 
 | ||||
|     // 测试日期有效性
 | ||||
|     Date d5(2007, 2, 29); | ||||
|     std::cout << "d5 为" << d5 << std::endl; | ||||
| } | ||||
| 
 | ||||
| // 测试日期比较
 | ||||
| void TestDate_2() | ||||
| { | ||||
|     Date d1(2018, 3, 5); | ||||
|     Date d2(2019, 6, 20); | ||||
|     Date d3(d1); | ||||
| 
 | ||||
|     // 测试 <
 | ||||
|     if (d1 < d2) | ||||
|     { | ||||
|         std::cout << d1 << " < " << d2 << std::endl; | ||||
|     } | ||||
|     if (d2 < d1) | ||||
|     { | ||||
|         std::cout << d2 << " < " << d1 << std::endl; | ||||
|     } | ||||
| 
 | ||||
|     // 测试 ==    !=
 | ||||
|     if (d1 == d3) | ||||
|     { | ||||
|         std::cout << d1 << " == " << d3 << std::endl; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         std::cout << d1 << " != " << d3 << std::endl; | ||||
|     } | ||||
|     if (d1 == d2) | ||||
|     { | ||||
|         std::cout << d1 << " == " << d2 << std::endl; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         std::cout << d1 << " != " << d2 << std::endl; | ||||
|     } | ||||
| 
 | ||||
|     // 测试 <=
 | ||||
|     if (d1 <= d2) | ||||
|     { | ||||
|         std::cout << d1 << " <= " << d2 << std::endl; | ||||
|     } | ||||
|     if (d2 <= d1) | ||||
|     { | ||||
|         std::cout << d2 << " <= " << d1 << std::endl; | ||||
|     } | ||||
| 
 | ||||
|     // 测试 >
 | ||||
|     if (d1 > d2) | ||||
|     { | ||||
|         std::cout << d1 << " > " << d2 << std::endl; | ||||
|     } | ||||
|     if (d2 > d1) | ||||
|     { | ||||
|         std::cout << d2 << " > " << d1 << std::endl; | ||||
|     } | ||||
| 
 | ||||
|     // 测试 >=
 | ||||
|     if (d1 >= d2) | ||||
|     { | ||||
|         std::cout << d1 << " >= " << d2 << std::endl; | ||||
|     } | ||||
|     if (d2 >= d1) | ||||
|     { | ||||
|         std::cout << d2 << " >= " << d1 << std::endl; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| // 测试日期增减
 | ||||
| void TestDate_3() | ||||
| { | ||||
|     Date d1(2024, 9, 2); | ||||
| 
 | ||||
|     // 测试打印函数
 | ||||
|     d1.Print(); | ||||
| 
 | ||||
|     // +
 | ||||
|     Date d2 = d1 + 100; | ||||
|     // +=
 | ||||
|     d1 += 100; | ||||
|     d1.Print(); | ||||
|     d2.Print(); | ||||
| 
 | ||||
|     // -
 | ||||
|     d2 = d1 - 100; | ||||
|     // -=
 | ||||
|     d1 -= 100; | ||||
|     d1.Print(); | ||||
|     d2.Print(); | ||||
| 
 | ||||
|     // += 负数
 | ||||
|     d2 = d1 + (-100); | ||||
|     d1 += -100; | ||||
|     d1.Print(); | ||||
|     d2.Print(); | ||||
| 
 | ||||
|     // -= 负数
 | ||||
|     d2 = d1 - (-100); | ||||
|     d1 -= -100; | ||||
|     d1.Print(); | ||||
|     d2.Print(); | ||||
| } | ||||
| 
 | ||||
| // 计算日期差
 | ||||
| void TestDate_4() | ||||
| { | ||||
|     Date d1(2024, 9, 2); | ||||
| 
 | ||||
|     // 前置 ++    后置 ++
 | ||||
|     Date d2 = ++d1; | ||||
|     Date d3 = d1++; | ||||
|     d1.Print(); | ||||
|     d2.Print(); | ||||
|     d3.Print(); | ||||
| 
 | ||||
|     // 前置 --    后置 --
 | ||||
|     d2 = --d1; | ||||
|     d3 = d1--; | ||||
|     d1.Print(); | ||||
|     d2.Print(); | ||||
|     d3.Print(); | ||||
| 
 | ||||
|     // 日期差值
 | ||||
|     Date d4 = d1 + 100; | ||||
|     std::cout << d4 << " - " << d1 << " = " << d4 - d1 << std::endl; | ||||
| 
 | ||||
|     // 日期修改
 | ||||
|     Date d5(2024, 9, 2); | ||||
|     std::cout << "修改前的 d5 为" << d5 << std::endl; | ||||
|     d5[0] = 2066, d5[1] = 6, d5[2] = 6; | ||||
|     std::cout << "修改后的 d5 为" << d5 << std::endl; | ||||
| 
 | ||||
|     // 测试输入
 | ||||
|     Date d6; | ||||
|     std::cin >> d6; | ||||
|     std::cout << "d6 为" << d6 << std::endl; | ||||
| } | ||||
| 
 | ||||
| int main() | ||||
| { | ||||
|     // TestDate_1();
 | ||||
| 
 | ||||
|     // TestDate_2();
 | ||||
| 
 | ||||
|     // TestDate_3();
 | ||||
| 
 | ||||
|     TestDate_4(); | ||||
| 
 | ||||
|     return 0; | ||||
| } | ||||
							
								
								
									
										301
									
								
								Linux/Date.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										301
									
								
								Linux/Date.hpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,301 @@ | ||||
| #pragma once | ||||
| 
 | ||||
| #include <iostream> | ||||
| 
 | ||||
| namespace Lenyiin | ||||
| { | ||||
|     class Date | ||||
|     { | ||||
|     private: | ||||
|         friend std::ostream &operator<<(std::ostream &_cout, const Date &d); | ||||
|         friend std::istream &operator>>(std::istream &_cin, Date &d); | ||||
| 
 | ||||
|         // 判断是否为闰年
 | ||||
|         bool isLeapYear(int year) const | ||||
|         { | ||||
|             return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); | ||||
|         } | ||||
| 
 | ||||
|         // 获取任意月份的天数
 | ||||
|         int GetMonthDay(int year, int month) | ||||
|         { | ||||
|             static int monthArray[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | ||||
|             int day = monthArray[month]; | ||||
| 
 | ||||
|             // 判断是否是闰年闰月
 | ||||
|             if (month == 2 && isLeapYear(year)) | ||||
|             { | ||||
|                 day = 29; | ||||
|             } | ||||
| 
 | ||||
|             return day; | ||||
|         } | ||||
| 
 | ||||
|         // 验证日期的有效性
 | ||||
|         bool isValidDate(int year, int month, int day) | ||||
|         { | ||||
|             // 月份必须在 1 到 12 之间
 | ||||
|             if (month < 1 || month > 12) | ||||
|             { | ||||
|                 return false; | ||||
|             } | ||||
| 
 | ||||
|             // 日期必须在 1 到 当月最大天数 之间
 | ||||
|             return day >= 1 && day <= GetMonthDay(year, month); | ||||
|         } | ||||
| 
 | ||||
|     public: | ||||
|         // 构造函数
 | ||||
|         Date(int year = 2024, int month = 1, int day = 1) | ||||
|         { | ||||
|             if (!isValidDate(year, month, day)) | ||||
|             { | ||||
|                 std::cerr << "Invalid date!" << std::endl; | ||||
|                 exit(1); // 终止程序, 日期无效
 | ||||
|             } | ||||
| 
 | ||||
|             _year = year; | ||||
|             _month = month; | ||||
|             _day = day; | ||||
|         } | ||||
| 
 | ||||
|         // 拷贝构造
 | ||||
|         Date(const Date &d) | ||||
|             : _year(d._year), _month(d._month), _day(d._day) | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|         void Print() | ||||
|         { | ||||
|             std::cout << _year << "-" << _month << "-" << _day << std::endl; | ||||
|         } | ||||
| 
 | ||||
|         // 赋值运算符重载
 | ||||
|         // 运算符重载,是为了让自定义类型可以像内置类型一样去使用运算符
 | ||||
|         // 自定义类型传参数和返回值时,在可以的情况下,尽量使用引用,减少拷贝的开销
 | ||||
|         // d1.operator==(d2);
 | ||||
|         bool operator==(const Date &d) const // bool operator==(Date* this, const Date& d) const
 | ||||
|         { | ||||
|             if (this->_year == d._year && this->_month == d._month && this->_day == d._day) | ||||
|             { | ||||
|                 return true; | ||||
|             } | ||||
|             return false; | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator<(&d2);
 | ||||
|         bool operator<(const Date &d) const // bool operator<(Date* this, const Date& d) const
 | ||||
|         { | ||||
|             if (this->_year < d._year) | ||||
|             { | ||||
|                 return true; | ||||
|             } | ||||
|             else if (this->_year == d._year && this->_month < d._month) | ||||
|             { | ||||
|                 return true; | ||||
|             } | ||||
|             else if (this->_year == d._year && this->_month == d._month && this->_day < d._day) | ||||
|             { | ||||
|                 return true; | ||||
|             } | ||||
|             return false; | ||||
|         } | ||||
| 
 | ||||
|         // d1 <= d2
 | ||||
|         // d1.operator<=(&d2);
 | ||||
|         bool operator<=(const Date &d) const // bool operator<=(Date* this, const Date& d) const
 | ||||
|         { | ||||
|             return (*this < d) || (*this == d); // 代码复用
 | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator>(d2);
 | ||||
|         bool operator>(const Date &d) const // bool operator>(Date* this, const Date& d) const
 | ||||
|         { | ||||
|             return d < *this; // 代码复用
 | ||||
|         } | ||||
| 
 | ||||
|         // d1 >= d2
 | ||||
|         // d1.operator>=(&d2);
 | ||||
|         bool operator>=(const Date &d) const // bool operator>=(Date* this, const Date& d) const
 | ||||
|         { | ||||
|             return !(*this < d); // 代码复用
 | ||||
|         } | ||||
| 
 | ||||
|         // d1 != d2
 | ||||
|         // d1.operator!=(&d2);
 | ||||
|         bool operator!=(const Date &d) const // bool operator!=(Date* this, const Date& d) const
 | ||||
|         { | ||||
|             return !(*this == d); // 代码复用
 | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator=(d2);
 | ||||
|         Date &operator=(const Date &d) // Date& operator=(Date* this, const Date& d)
 | ||||
|         { | ||||
|             if (*this != d) | ||||
|             { | ||||
|                 _year = d._year; | ||||
|                 _month = d._month; | ||||
|                 _day = d._day; | ||||
|             } | ||||
|             return *this; | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator+=(int);
 | ||||
|         Date &operator+=(int day) // Date& operator+=(Date* this, int day)
 | ||||
|         { | ||||
|             if (day < 0) | ||||
|             { | ||||
|                 return *this -= -day; | ||||
|             } | ||||
| 
 | ||||
|             _day += day; | ||||
|             while (_day > GetMonthDay(_year, _month)) | ||||
|             { | ||||
|                 // 如果日期不合法,就要往月进位
 | ||||
|                 _day -= GetMonthDay(_year, _month); | ||||
|                 _month++; | ||||
| 
 | ||||
|                 // 如果月不合法,就要往年进位
 | ||||
|                 if (_month > 12) | ||||
|                 { | ||||
|                     _year++; | ||||
|                     _month = 1; | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             return *this; | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator+(int);
 | ||||
|         Date operator+(int day) // Date operator+(Date* this, int day)
 | ||||
|         { | ||||
|             Date ret(*this); // Date ret(this->_year, this->_month, this->_day);
 | ||||
|             return ret += day; | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator-=(int);
 | ||||
|         Date &operator-=(int day) // Date& operator-=(Date* this, int day)
 | ||||
|         { | ||||
|             if (day < 0) | ||||
|             { | ||||
|                 return *this += -day; | ||||
|             } | ||||
| 
 | ||||
|             _day -= day; | ||||
|             while (_day < 1) | ||||
|             { | ||||
|                 // 如果日期不合法, 就要往月退位, 月不合法就要往年退位
 | ||||
|                 _month--; | ||||
|                 if (_month == 0) | ||||
|                 { | ||||
|                     _year--; | ||||
|                     _month = 12; | ||||
|                 } | ||||
|                 _day += GetMonthDay(_year, _month); | ||||
|             } | ||||
| 
 | ||||
|             return *this; | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator-(int);
 | ||||
|         Date operator-(int day) // Date operator-(Date* this, int day)
 | ||||
|         { | ||||
|             Date ret(*this); | ||||
|             return ret -= day; | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator++();	// 前置++
 | ||||
|         Date &operator++() // Date& operator++(Date* this)
 | ||||
|         { | ||||
|             *this += 1; | ||||
|             return *this; // 返回加之后的结果
 | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator++(int);	// 后置++
 | ||||
|         Date operator++(int) // Date operator++(Date* this, int)
 | ||||
|         { | ||||
|             Date ret(*this); | ||||
|             *this += 1; | ||||
|             return ret; // 返回加之前的结果
 | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator--();	// 前置--
 | ||||
|         Date &operator--() // Date& operator--(Date* this)
 | ||||
|         { | ||||
|             *this -= 1; | ||||
|             return *this; | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator--(int);	// 后置--
 | ||||
|         Date operator--(int) // Date operator--(Date* this, int)
 | ||||
|         { | ||||
|             Date ret(*this); | ||||
|             *this -= 1; | ||||
|             return ret; | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator-(d2);
 | ||||
|         int operator-(const Date &d) // int operator-(Date* this, const Date& d)
 | ||||
|         { | ||||
|             Date max = *this; | ||||
|             Date min = d; | ||||
|             int flag = 1; | ||||
| 
 | ||||
|             if (*this < d) | ||||
|             { | ||||
|                 max = d; | ||||
|                 min = *this; | ||||
|                 flag = -1; | ||||
|             } | ||||
| 
 | ||||
|             int count = 0; | ||||
|             while (min != max) | ||||
|             { | ||||
|                 ++min; | ||||
|                 count++; | ||||
|             } | ||||
| 
 | ||||
|             return count * flag; | ||||
|         } | ||||
| 
 | ||||
|         // d1.operator[](int);
 | ||||
|         int &operator[](int index) // int& operator[](Date* this, int index)
 | ||||
|         { | ||||
|             if (index == 0) | ||||
|             { | ||||
|                 return _year; | ||||
|             } | ||||
|             else if (index == 1) | ||||
|             { | ||||
|                 return _month; | ||||
|             } | ||||
|             else if (index == 2) | ||||
|             { | ||||
|                 return _day; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         // 析构函数
 | ||||
|         ~Date() | ||||
|         { | ||||
|             std::cout << "~Date()" << std::endl; | ||||
|         } | ||||
| 
 | ||||
|     private: | ||||
|         int _year; | ||||
|         int _month; | ||||
|         int _day; | ||||
|     }; | ||||
| 
 | ||||
|     std::ostream &operator<<(std::ostream &_cout, const Date &d) | ||||
|     { | ||||
|         _cout << d._year << "-" << d._month << "-" << d._day; | ||||
|         return _cout; | ||||
|     } | ||||
| 
 | ||||
|     std::istream &operator>>(std::istream &_cin, Date &d) | ||||
|     { | ||||
|         _cin >> d._year >> d._month >> d._day; | ||||
|         return _cin; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										5
									
								
								Linux/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								Linux/Makefile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | ||||
| date:Date.cc | ||||
| 	g++ -o $@ $^ | ||||
| .PHONY:clean | ||||
| clean: | ||||
| 	rm -f date | ||||
							
								
								
									
										
											BIN
										
									
								
								Linux/date
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Linux/date
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/.vs/Windows_Date/v17/.suo
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/.vs/Windows_Date/v17/.suo
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/.vs/Windows_Date/v17/Browse.VC.db
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/.vs/Windows_Date/v17/Browse.VC.db
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										179
									
								
								Windows_Date/Date.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										179
									
								
								Windows_Date/Date.cpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,179 @@ | ||||
| #include "Date.hpp" | ||||
| using namespace Lenyiin; | ||||
| 
 | ||||
| // 测试构造析构函数
 | ||||
| void TestDate_1() | ||||
| { | ||||
|     // 默认无参构造
 | ||||
|     Date d1; | ||||
|     // 默认有参构造
 | ||||
|     Date d2(2024, 9, 1); | ||||
|     // 拷贝构造
 | ||||
|     Date d3(d2); | ||||
| 
 | ||||
|     // 测试输出功能
 | ||||
|     std::cout << "d1 为 " << d1 << std::endl; | ||||
|     std::cout << "d2 为 " << d2 << std::endl; | ||||
|     std::cout << "d3 为 " << d3 << std::endl; | ||||
| 
 | ||||
|     // 赋值拷贝
 | ||||
|     d1 = d3; | ||||
|     std::cout << "d1 为" << d1 << std::endl; | ||||
| 
 | ||||
|     // 测试闰年闰月
 | ||||
|     Date d4(2008, 2, 29); | ||||
|     std::cout << "d4 为" << d4 << std::endl; | ||||
| 
 | ||||
|     // 测试日期有效性
 | ||||
|     Date d5(2007, 2, 29); | ||||
|     std::cout << "d5 为" << d5 << std::endl; | ||||
| } | ||||
| 
 | ||||
| // 测试日期比较
 | ||||
| void TestDate_2() | ||||
| { | ||||
|     Date d1(2018, 3, 5); | ||||
|     Date d2(2019, 6, 20); | ||||
|     Date d3(d1); | ||||
| 
 | ||||
|     // 测试 < 
 | ||||
|     if (d1 < d2) | ||||
|     { | ||||
|         std::cout << d1 << " < " << d2 << std::endl; | ||||
|     } | ||||
|     if (d2 < d1) | ||||
|     { | ||||
|         std::cout << d2 << " < " << d1 << std::endl; | ||||
|     } | ||||
| 
 | ||||
|     // 测试 ==    !=
 | ||||
|     if (d1 == d3) | ||||
|     { | ||||
|         std::cout << d1 << " == " << d3 << std::endl; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         std::cout << d1 << " != " << d3 << std::endl; | ||||
|     } | ||||
|     if (d1 == d2) | ||||
|     { | ||||
|         std::cout << d1 << " == " << d2 << std::endl; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         std::cout << d1 << " != " << d2 << std::endl; | ||||
|     } | ||||
| 
 | ||||
|     // 测试 <= 
 | ||||
|     if (d1 <= d2) | ||||
|     { | ||||
|         std::cout << d1 << " <= " << d2 << std::endl; | ||||
|     } | ||||
|     if (d2 <= d1) | ||||
|     { | ||||
|         std::cout << d2 << " <= " << d1 << std::endl; | ||||
|     } | ||||
| 
 | ||||
|     // 测试 >
 | ||||
|     if (d1 > d2) | ||||
|     { | ||||
|         std::cout << d1 << " > " << d2 << std::endl; | ||||
|     } | ||||
|     if (d2 > d1) | ||||
|     { | ||||
|         std::cout << d2 << " > " << d1 << std::endl; | ||||
|     } | ||||
| 
 | ||||
|     //测试 >=
 | ||||
|     if (d1 >= d2) | ||||
|     { | ||||
|         std::cout << d1 << " >= " << d2 << std::endl; | ||||
|     } | ||||
|     if (d2 >= d1) | ||||
|     { | ||||
|         std::cout << d2 << " >= " << d1 << std::endl; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| // 测试日期增减
 | ||||
| void TestDate_3() | ||||
| { | ||||
|     Date d1(2024, 9, 2); | ||||
| 
 | ||||
|     // 测试打印函数
 | ||||
|     d1.Print(); | ||||
| 
 | ||||
|     // +
 | ||||
|     Date d2 = d1 + 100; | ||||
|     // +=
 | ||||
|     d1 += 100; | ||||
|     d1.Print(); | ||||
|     d2.Print(); | ||||
| 
 | ||||
|     // -
 | ||||
|     d2 = d1 - 100; | ||||
|     // -=
 | ||||
|     d1 -= 100; | ||||
|     d1.Print(); | ||||
|     d2.Print(); | ||||
| 
 | ||||
|     // += 负数
 | ||||
|     d2 = d1 + (-100); | ||||
|     d1 += -100; | ||||
|     d1.Print(); | ||||
|     d2.Print(); | ||||
| 
 | ||||
|     // -= 负数
 | ||||
|     d2 = d1 - (-100); | ||||
|     d1 -= -100; | ||||
|     d1.Print(); | ||||
|     d2.Print(); | ||||
| } | ||||
| 
 | ||||
| // 计算日期差
 | ||||
| void TestDate_4() | ||||
| { | ||||
|     Date d1(2024, 9, 2); | ||||
| 
 | ||||
|     // 前置 ++    后置 ++
 | ||||
|     Date d2 = ++d1; | ||||
|     Date d3 = d1++; | ||||
|     d1.Print(); | ||||
|     d2.Print(); | ||||
|     d3.Print(); | ||||
| 
 | ||||
|     // 前置 --    后置 --
 | ||||
|     d2 = --d1; | ||||
|     d3 = d1--; | ||||
|     d1.Print(); | ||||
|     d2.Print(); | ||||
|     d3.Print(); | ||||
| 
 | ||||
|     // 日期差值
 | ||||
|     Date d4 = d1 + 100; | ||||
|     std::cout << d4 << " - " << d1 << " = " << d4 - d1 << std::endl; | ||||
| 
 | ||||
|     // 日期修改
 | ||||
|     Date d5(2024, 9, 2); | ||||
|     std::cout << "修改前的 d5 为" << d5 << std::endl; | ||||
|     d5[0] = 2066, d5[1] = 6, d5[2] = 6; | ||||
|     std::cout << "修改后的 d5 为" << d5 << std::endl; | ||||
| 
 | ||||
|     // 测试输入
 | ||||
|     Date d6; | ||||
|     std::cin >> d6; | ||||
|     std::cout << "d6 为" << d6 << std::endl; | ||||
| } | ||||
| 
 | ||||
| int main() | ||||
| { | ||||
|     //TestDate_1();
 | ||||
| 
 | ||||
|     //TestDate_2();
 | ||||
| 
 | ||||
|     //TestDate_3();
 | ||||
| 
 | ||||
|     TestDate_4(); | ||||
| 
 | ||||
|     return 0; | ||||
| } | ||||
							
								
								
									
										302
									
								
								Windows_Date/Date.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										302
									
								
								Windows_Date/Date.hpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,302 @@ | ||||
| #pragma once | ||||
| 
 | ||||
| #include <iostream> | ||||
| 
 | ||||
| namespace Lenyiin | ||||
| { | ||||
| 	class Date | ||||
| 	{ | ||||
| 	private: | ||||
| 		friend std::ostream& operator<<(std::ostream& _cout, const Date& d); | ||||
| 		friend std::istream& operator>>(std::istream& _cin, Date& d); | ||||
| 
 | ||||
| 		// 判断是否为闰年
 | ||||
| 		bool isLeapYear(int year) const | ||||
| 		{ | ||||
| 			return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); | ||||
| 		} | ||||
| 
 | ||||
| 		// 获取任意月份的天数
 | ||||
| 		int GetMonthDay(int year, int month) | ||||
| 		{ | ||||
| 			static int monthArray[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; | ||||
| 			int day = monthArray[month]; | ||||
| 
 | ||||
| 			// 判断是否是闰年闰月
 | ||||
| 			if (month == 2 && isLeapYear(year)) | ||||
| 			{ | ||||
| 				day = 29; | ||||
| 			} | ||||
| 
 | ||||
| 			return day; | ||||
| 		} | ||||
| 
 | ||||
| 		// 验证日期的有效性
 | ||||
| 		bool isValidDate(int year, int month, int day) | ||||
| 		{ | ||||
| 			// 月份必须在 1 到 12 之间
 | ||||
| 			if (month < 1 || month > 12) | ||||
| 			{ | ||||
| 				return false; | ||||
| 			} | ||||
| 
 | ||||
| 			// 日期必须在 1 到 当月最大天数 之间
 | ||||
| 			return day >= 1 && day <= GetMonthDay(year, month); | ||||
| 		} | ||||
| 
 | ||||
| 	public: | ||||
| 		// 构造函数
 | ||||
| 		Date(int year = 2024, int month = 1, int day = 1) | ||||
| 		{ | ||||
| 			if (!isValidDate(year, month, day)) | ||||
| 			{ | ||||
| 				std::cerr << "Invalid date!" << std::endl; | ||||
| 				exit(1);	// 终止程序, 日期无效
 | ||||
| 			} | ||||
| 
 | ||||
| 			_year = year; | ||||
| 			_month = month; | ||||
| 			_day = day; | ||||
| 		} | ||||
| 
 | ||||
| 		// 拷贝构造
 | ||||
| 		Date(const Date& d) | ||||
| 			: _year(d._year), _month(d._month), _day(d._day) | ||||
| 		{ | ||||
| 
 | ||||
| 		} | ||||
| 
 | ||||
| 		void Print() | ||||
| 		{ | ||||
| 			std::cout << _year << "-" << _month << "-" << _day << std::endl; | ||||
| 		} | ||||
| 
 | ||||
| 		// 赋值运算符重载
 | ||||
| 		// 运算符重载,是为了让自定义类型可以像内置类型一样去使用运算符
 | ||||
| 		// 自定义类型传参数和返回值时,在可以的情况下,尽量使用引用,减少拷贝的开销
 | ||||
| 		// d1.operator==(d2);
 | ||||
| 		bool operator==(const Date& d) const	// bool operator==(Date* this, const Date& d) const
 | ||||
| 		{ | ||||
| 			if (this->_year == d._year && this->_month == d._month && this->_day == d._day) | ||||
| 			{ | ||||
| 				return true; | ||||
| 			} | ||||
| 			return false; | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator<(&d2);
 | ||||
| 		bool operator<(const Date& d) const	// bool operator<(Date* this, const Date& d) const
 | ||||
| 		{ | ||||
| 			if (this->_year < d._year) | ||||
| 			{ | ||||
| 				return true; | ||||
| 			} | ||||
| 			else if (this->_year == d._year && this->_month < d._month) | ||||
| 			{ | ||||
| 				return true; | ||||
| 			} | ||||
| 			else if (this->_year == d._year && this->_month == d._month && this->_day < d._day) | ||||
| 			{ | ||||
| 				return true; | ||||
| 			} | ||||
| 			return false; | ||||
| 		} | ||||
| 
 | ||||
| 		// d1 <= d2
 | ||||
| 		// d1.operator<=(&d2);
 | ||||
| 		bool operator<=(const Date& d) const // bool operator<=(Date* this, const Date& d) const
 | ||||
| 		{ | ||||
| 			return (*this < d) || (*this == d); // 代码复用
 | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator>(d2);
 | ||||
| 		bool operator>(const Date& d) const	// bool operator>(Date* this, const Date& d) const
 | ||||
| 		{ | ||||
| 			return d < *this;	// 代码复用
 | ||||
| 		} | ||||
| 
 | ||||
| 		// d1 >= d2
 | ||||
| 		// d1.operator>=(&d2);
 | ||||
| 		bool operator>=(const Date& d) const // bool operator>=(Date* this, const Date& d) const
 | ||||
| 		{ | ||||
| 			return !(*this < d); // 代码复用
 | ||||
| 		} | ||||
| 
 | ||||
| 		// d1 != d2
 | ||||
| 		// d1.operator!=(&d2);
 | ||||
| 		bool operator!=(const Date& d) const // bool operator!=(Date* this, const Date& d) const
 | ||||
| 		{ | ||||
| 			return !(*this == d); // 代码复用
 | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator=(d2);
 | ||||
| 		Date& operator=(const Date& d) // Date& operator=(Date* this, const Date& d)
 | ||||
| 		{ | ||||
| 			if (*this != d) | ||||
| 			{ | ||||
| 				_year = d._year; | ||||
| 				_month = d._month; | ||||
| 				_day = d._day; | ||||
| 			} | ||||
| 			return *this; | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator+=(int);
 | ||||
| 		Date& operator+=(int day)	// Date& operator+=(Date* this, int day)
 | ||||
| 		{ | ||||
| 			if (day < 0) | ||||
| 			{ | ||||
| 				return *this -= -day; | ||||
| 			} | ||||
| 
 | ||||
| 			_day += day; | ||||
| 			while (_day > GetMonthDay(_year, _month)) | ||||
| 			{ | ||||
| 				// 如果日期不合法,就要往月进位
 | ||||
| 				_day -= GetMonthDay(_year, _month); | ||||
| 				_month++; | ||||
| 
 | ||||
| 				// 如果月不合法,就要往年进位
 | ||||
| 				if (_month > 12) | ||||
| 				{ | ||||
| 					_year++; | ||||
| 					_month = 1; | ||||
| 				} | ||||
| 			} | ||||
| 
 | ||||
| 			return *this; | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator+(int);
 | ||||
| 		Date operator+(int day)	// Date operator+(Date* this, int day)
 | ||||
| 		{ | ||||
| 			Date ret(*this);	// Date ret(this->_year, this->_month, this->_day);
 | ||||
| 			return ret += day; | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator-=(int);
 | ||||
| 		Date& operator-=(int day) // Date& operator-=(Date* this, int day)
 | ||||
| 		{ | ||||
| 			if (day < 0) | ||||
| 			{ | ||||
| 				return *this += -day; | ||||
| 			} | ||||
| 
 | ||||
| 			_day -= day; | ||||
| 			while (_day < 1) | ||||
| 			{ | ||||
| 				// 如果日期不合法, 就要往月退位, 月不合法就要往年退位
 | ||||
| 				_month--; | ||||
| 				if (_month == 0) | ||||
| 				{ | ||||
| 					_year--; | ||||
| 					_month = 12; | ||||
| 				} | ||||
| 				_day += GetMonthDay(_year, _month); | ||||
| 			} | ||||
| 
 | ||||
| 			return *this; | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator-(int);
 | ||||
| 		Date operator-(int day) // Date operator-(Date* this, int day)
 | ||||
| 		{ | ||||
| 			Date ret(*this); | ||||
| 			return ret -= day; | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator++();	// 前置++
 | ||||
| 		Date& operator++()	// Date& operator++(Date* this)
 | ||||
| 		{ | ||||
| 			*this += 1; | ||||
| 			return *this;	// 返回加之后的结果
 | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator++(int);	// 后置++
 | ||||
| 		Date operator++(int) 	// Date operator++(Date* this, int)
 | ||||
| 		{ | ||||
| 			Date ret(*this); | ||||
| 			*this += 1; | ||||
| 			return ret;			// 返回加之前的结果
 | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator--();	// 前置--
 | ||||
| 		Date& operator--() 	// Date& operator--(Date* this)
 | ||||
| 		{ | ||||
| 			*this -= 1; | ||||
| 			return *this; | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator--(int);	// 后置--
 | ||||
| 		Date operator--(int) 	// Date operator--(Date* this, int)
 | ||||
| 		{ | ||||
| 			Date ret(*this); | ||||
| 			*this -= 1; | ||||
| 			return ret; | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator-(d2);
 | ||||
| 		int operator-(const Date& d)	// int operator-(Date* this, const Date& d)
 | ||||
| 		{ | ||||
| 			Date max = *this; | ||||
| 			Date min = d; | ||||
| 			int flag = 1; | ||||
| 
 | ||||
| 			if (*this < d) | ||||
| 			{ | ||||
| 				max = d; | ||||
| 				min = *this; | ||||
| 				flag = -1; | ||||
| 			} | ||||
| 
 | ||||
| 			int count = 0; | ||||
| 			while (min != max) | ||||
| 			{ | ||||
| 				++min; | ||||
| 				count++; | ||||
| 			} | ||||
| 
 | ||||
| 			return count * flag; | ||||
| 		} | ||||
| 
 | ||||
| 		// d1.operator[](int);
 | ||||
| 		int& operator[](int index) // int& operator[](Date* this, int index)
 | ||||
| 		{ | ||||
| 			if (index == 0) | ||||
| 			{ | ||||
| 				return _year; | ||||
| 			} | ||||
| 			else if (index == 1) | ||||
| 			{ | ||||
| 				return _month; | ||||
| 			} | ||||
| 			else if (index == 2) | ||||
| 			{ | ||||
| 				return _day; | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		// 析构函数
 | ||||
| 		~Date() | ||||
| 		{ | ||||
| 			std::cout << "~Date()" << std::endl; | ||||
| 		} | ||||
| 
 | ||||
| 	private: | ||||
| 		int _year; | ||||
| 		int _month; | ||||
| 		int _day; | ||||
| 	}; | ||||
| 
 | ||||
| 	std::ostream& operator<<(std::ostream& _cout, const Date& d) | ||||
| 	{ | ||||
| 		_cout << d._year << "-" << d._month << "-" << d._day; | ||||
| 		return _cout; | ||||
| 	} | ||||
| 
 | ||||
| 	std::istream& operator>>(std::istream& _cin, Date& d) | ||||
| 	{ | ||||
| 		_cin >> d._year >> d._month >> d._day; | ||||
| 		return _cin; | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										31
									
								
								Windows_Date/Windows_Date.sln
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								Windows_Date/Windows_Date.sln
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,31 @@ | ||||
|  | ||||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||||
| # Visual Studio Version 17 | ||||
| VisualStudioVersion = 17.7.34221.43 | ||||
| MinimumVisualStudioVersion = 10.0.40219.1 | ||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Windows_Date", "Windows_Date.vcxproj", "{E23EDFCA-3BC8-4847-9E19-7321D4E46286}" | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| 		Debug|x64 = Debug|x64 | ||||
| 		Debug|x86 = Debug|x86 | ||||
| 		Release|x64 = Release|x64 | ||||
| 		Release|x86 = Release|x86 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||||
| 		{E23EDFCA-3BC8-4847-9E19-7321D4E46286}.Debug|x64.ActiveCfg = Debug|x64 | ||||
| 		{E23EDFCA-3BC8-4847-9E19-7321D4E46286}.Debug|x64.Build.0 = Debug|x64 | ||||
| 		{E23EDFCA-3BC8-4847-9E19-7321D4E46286}.Debug|x86.ActiveCfg = Debug|Win32 | ||||
| 		{E23EDFCA-3BC8-4847-9E19-7321D4E46286}.Debug|x86.Build.0 = Debug|Win32 | ||||
| 		{E23EDFCA-3BC8-4847-9E19-7321D4E46286}.Release|x64.ActiveCfg = Release|x64 | ||||
| 		{E23EDFCA-3BC8-4847-9E19-7321D4E46286}.Release|x64.Build.0 = Release|x64 | ||||
| 		{E23EDFCA-3BC8-4847-9E19-7321D4E46286}.Release|x86.ActiveCfg = Release|Win32 | ||||
| 		{E23EDFCA-3BC8-4847-9E19-7321D4E46286}.Release|x86.Build.0 = Release|Win32 | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(SolutionProperties) = preSolution | ||||
| 		HideSolutionNode = FALSE | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(ExtensibilityGlobals) = postSolution | ||||
| 		SolutionGuid = {CB230911-DB6C-4E35-ABA2-5F9A64C579A4} | ||||
| 	EndGlobalSection | ||||
| EndGlobal | ||||
							
								
								
									
										138
									
								
								Windows_Date/Windows_Date.vcxproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										138
									
								
								Windows_Date/Windows_Date.vcxproj
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,138 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup Label="ProjectConfigurations"> | ||||
|     <ProjectConfiguration Include="Debug|Win32"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|Win32"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>Win32</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Debug|x64"> | ||||
|       <Configuration>Debug</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|     <ProjectConfiguration Include="Release|x64"> | ||||
|       <Configuration>Release</Configuration> | ||||
|       <Platform>x64</Platform> | ||||
|     </ProjectConfiguration> | ||||
|   </ItemGroup> | ||||
|   <PropertyGroup Label="Globals"> | ||||
|     <VCProjectVersion>17.0</VCProjectVersion> | ||||
|     <Keyword>Win32Proj</Keyword> | ||||
|     <ProjectGuid>{e23edfca-3bc8-4847-9e19-7321d4e46286}</ProjectGuid> | ||||
|     <RootNamespace>WindowsDate</RootNamespace> | ||||
|     <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>Application</ConfigurationType> | ||||
|     <UseDebugLibraries>true</UseDebugLibraries> | ||||
|     <PlatformToolset>v143</PlatformToolset> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||||
|     <ConfigurationType>Application</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <PlatformToolset>v143</PlatformToolset> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>Application</ConfigurationType> | ||||
|     <UseDebugLibraries>true</UseDebugLibraries> | ||||
|     <PlatformToolset>v143</PlatformToolset> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||||
|     <ConfigurationType>Application</ConfigurationType> | ||||
|     <UseDebugLibraries>false</UseDebugLibraries> | ||||
|     <PlatformToolset>v143</PlatformToolset> | ||||
|     <WholeProgramOptimization>true</WholeProgramOptimization> | ||||
|     <CharacterSet>Unicode</CharacterSet> | ||||
|   </PropertyGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||||
|   <ImportGroup Label="ExtensionSettings"> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="Shared"> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||||
|   </ImportGroup> | ||||
|   <PropertyGroup Label="UserMacros" /> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <SDLCheck>true</SDLCheck> | ||||
|       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <ConformanceMode>true</ConformanceMode> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Console</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <SDLCheck>true</SDLCheck> | ||||
|       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <ConformanceMode>true</ConformanceMode> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Console</SubSystem> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <SDLCheck>true</SDLCheck> | ||||
|       <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <ConformanceMode>true</ConformanceMode> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Console</SubSystem> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||||
|     <ClCompile> | ||||
|       <WarningLevel>Level3</WarningLevel> | ||||
|       <FunctionLevelLinking>true</FunctionLevelLinking> | ||||
|       <IntrinsicFunctions>true</IntrinsicFunctions> | ||||
|       <SDLCheck>true</SDLCheck> | ||||
|       <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||||
|       <ConformanceMode>true</ConformanceMode> | ||||
|     </ClCompile> | ||||
|     <Link> | ||||
|       <SubSystem>Console</SubSystem> | ||||
|       <EnableCOMDATFolding>true</EnableCOMDATFolding> | ||||
|       <OptimizeReferences>true</OptimizeReferences> | ||||
|       <GenerateDebugInformation>true</GenerateDebugInformation> | ||||
|     </Link> | ||||
|   </ItemDefinitionGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="Date.hpp" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="Date.cpp" /> | ||||
|   </ItemGroup> | ||||
|   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||||
|   <ImportGroup Label="ExtensionTargets"> | ||||
|   </ImportGroup> | ||||
| </Project> | ||||
							
								
								
									
										27
									
								
								Windows_Date/Windows_Date.vcxproj.filters
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								Windows_Date/Windows_Date.vcxproj.filters
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <ItemGroup> | ||||
|     <Filter Include="源文件"> | ||||
|       <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||||
|       <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||||
|     </Filter> | ||||
|     <Filter Include="头文件"> | ||||
|       <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||||
|       <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions> | ||||
|     </Filter> | ||||
|     <Filter Include="资源文件"> | ||||
|       <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||||
|       <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | ||||
|     </Filter> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClInclude Include="Date.hpp"> | ||||
|       <Filter>头文件</Filter> | ||||
|     </ClInclude> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <ClCompile Include="Date.cpp"> | ||||
|       <Filter>源文件</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
| </Project> | ||||
							
								
								
									
										4
									
								
								Windows_Date/Windows_Date.vcxproj.user
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								Windows_Date/Windows_Date.vcxproj.user
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|   <PropertyGroup /> | ||||
| </Project> | ||||
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Date.obj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Date.obj
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.exe
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.exe
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										11
									
								
								Windows_Date/x64/Debug/Windows_Date.exe.recipe
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Windows_Date/x64/Debug/Windows_Date.exe.recipe
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <Project> | ||||
|   <ProjectOutputs> | ||||
|     <ProjectOutput> | ||||
|       <FullPath>E:\Git 仓库\公开仓库\1_Date\Windows_Date\x64\Debug\Windows_Date.exe</FullPath> | ||||
|     </ProjectOutput> | ||||
|   </ProjectOutputs> | ||||
|   <ContentFiles /> | ||||
|   <SatelliteDlls /> | ||||
|   <NonRecipeFileRefs /> | ||||
| </Project> | ||||
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.ilk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.ilk
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										3
									
								
								Windows_Date/x64/Debug/Windows_Date.log
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								Windows_Date/x64/Debug/Windows_Date.log
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | ||||
|   Date.cpp | ||||
| E:\Git 仓库\公开仓库\1_Date\Windows_Date\Date.hpp(277): warning C4715: “Lenyiin::Date::operator[]”: 不是所有的控件路径都返回值 | ||||
|   Windows_Date.vcxproj -> E:\Git 仓库\公开仓库\1_Date\Windows_Date\x64\Debug\Windows_Date.exe | ||||
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.pdb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.pdb
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/CL.command.1.tlog
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/CL.command.1.tlog
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/CL.read.1.tlog
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/CL.read.1.tlog
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/CL.write.1.tlog
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/CL.write.1.tlog
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										1
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/Cl.items.tlog
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/Cl.items.tlog
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| E:\Git 仓库\公开仓库\1_Date\Windows_Date\Date.cpp;E:\Git 仓库\公开仓库\1_Date\Windows_Date\x64\Debug\Date.obj | ||||
| @ -0,0 +1,2 @@ | ||||
| PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.37.32822:TargetPlatformVersion=10.0.22000.0: | ||||
| Debug|x64|E:\Git 仓库\公开仓库\1_Date\Windows_Date\| | ||||
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/link.command.1.tlog
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/link.command.1.tlog
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/link.read.1.tlog
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/link.read.1.tlog
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/link.write.1.tlog
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/Windows_Date.tlog/link.write.1.tlog
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -0,0 +1 @@ | ||||
| E:\Git 仓库\公开仓库\1_Date\Windows_Date\x64\Debug\Windows_Date.exe | ||||
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/vc143.idb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/vc143.idb
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/vc143.pdb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Windows_Date/x64/Debug/vc143.pdb
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Lenyiin
						Lenyiin