当前位置: 首页 > news >正文

自学网站建设推荐网站后台登陆不了

自学网站建设推荐,网站后台登陆不了,it培训机构培训多久,装修风格大全2021新款简约在上学的时候#xff0c;总是在计算还有多少天放假#xff1b;在上班的时候#xff0c;总是在计算还有多久发工资#xff1f;我们一般通过日历得到结果#xff0c;那自己能不能实现一些基本的功能呢#xff1f;答案是可以的#xff01;需要实现内容#xff1a;1. 日期加…在上学的时候总是在计算还有多少天放假在上班的时候总是在计算还有多久发工资我们一般通过日历得到结果那自己能不能实现一些基本的功能呢答案是可以的需要实现内容1. 日期加减天数 //d150 Date Date::operator(int day) {_day day;while (_day GetMonthDay(_year, _month)){_day - GetMonthDay(_year, _month);_month;if (_month 12){_year;_month 1;//_day - GetMonthDay(_year, _month); // error - _month已经发生改变}}return *this; }//d150(不会改变d1) Date Date::operator(int day) {//创建临时对象改变贫道不改变己身Date tmp(*this);tmp day;return tmp; }// d1 Date Date::operator() {*this 1;return *this; } // d1 Date Date::operator(int x) {Date tmp(*this);*this 1;return tmp; } // d1-50 Date Date::operator-(int day) {_day - day;while (_day 0){_month--;if (_month 0){_year--;_month 12;}_day GetMonthDay(_year, _month);;}return *this; } // d1-50 Date Date::operator-(int day) const {Date tmp(*this);tmp - day;return tmp; }// --d1 Date Date::operator--() {*this - 1;return *this; } // d1-- Date Date::operator--(int) {Date tmp(*this);*this - 1;return tmp; }2. 日期减日期 int Date::operator-(const Date d) {Date max *this;Date min d;int flag 1;int count 0;if (*this d){max d;min *this;flag -1;}int day1 max._day;int day2 min._day;int n max._year - min._year;if (max._year min._year){n 0;}// 2025 1 31while (max._month ! 1 || max._day ! 1){max._month--;if (max._month 0){max._month 12;max._year--;break;}max._day GetMonthDay(max._year, max._month);day1 max._day;}//2024 1 1while (min._month ! 1 || min._day ! 1){min._month--;if (min._month 0){min._month 12;min._year--;break;}min._day GetMonthDay(min._year, min._month);day2 min._day;}int x min._year;while (x max._year){count Getleapyear(min._year 1);x;}return day1 - day2 365 * n count1; }第二种就是直接暴力计算如下 int Date::operator-(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; }3. 完整代码Date.h 文件 #pragma once #include iostream using namespace std; #include assert.hclass Date { public:Date(int year 1, int month 1,int day1){_year year;_month month;_day day;}int GetMonthDay(int year, int month){assert(month 0 month 13);// 为了避免每次调用都开辟空间可以加static存放到全局static int arr[13] { -1,31,28,31,30,31,30,31,31,30,31,30,31 };if (month 2 ((year % 4 0 year % 100 ! 0) || (year % 400 0))){return 29;}elsereturn arr[month];}int Getleapyear(int year){if ((year % 4 0 year % 100 ! 0) || (year % 400 0)){return 1;}elsereturn 0;}Date(const Date d){_year d._year;_month d._month;_day d._day;}void Print(){cout _year 年 _month 月 _day 日 endl;}// 日期dayDate operator(int day);Date operator(int day)const;Date operator-(int day);Date operator-(int day)const;// d1Date operator();// d1Date operator(int);// --d1Date operator--();// d1--Date operator--(int);int operator-(const Date d)const;bool operator(const Date d)const;bool operator!(const Date d)const;bool operator(const Date d)const;bool operator(const Date d)const;bool operator(const Date d)const;bool operator(const Date d)const;~Date(){} private:int _year;int _month;int _day; };Date.cpp 文件 #include Date.h//d150 Date Date::operator(int day) {_day day;while (_day GetMonthDay(_year, _month)){_day - GetMonthDay(_year, _month);_month;if (_month 12){_year;_month 1;//_day - GetMonthDay(_year, _month); // error - _month已经发生改变}}return *this; }//d150(不会改变d1) Date Date::operator(int day) const {//创建临时对象改变贫道不改变己身Date tmp(*this);tmp day;return tmp; }// d1-50 Date Date::operator-(int day) {_day - day;while (_day 0){_month--;if (_month 0){_year--;_month 12;}_day GetMonthDay(_year, _month);;}return *this; } //// d1-50 //Date Date::operator-(int day) const //{ // Date tmp(*this); // tmp._day - day; // while (tmp._day 0) // { // tmp._month--; // if (tmp._month 0) // { // tmp._year--; // tmp._month 12; // } // tmp._day GetMonthDay(tmp._year, tmp._month);//error - 这里传的是const Date* this,权限放大 // } // return tmp; //}// d1-50 Date Date::operator-(int day) const {Date tmp(*this);tmp - day;return tmp; }// d2 d1 Date Date::operator() {*this 1;return *this; } // d2 d1 Date Date::operator(int x) {Date tmp(*this);*this 1;return tmp; }// --d1 Date Date::operator--() {*this - 1;return *this; } // d1-- Date Date::operator--(int) {Date tmp(*this);*this - 1;return tmp; }bool Date::operator(const Date d) const {return _year d._year _month d._month _day d._day; }bool Date::operator!(const Date d) const {return !(*this d); }bool Date::operator(const Date d) const {if (_year d._year){return true;}else if (_year d._year _month d._month){return true;}else if (_year d._year _month d._month _day d._day){return true;}elsereturn false; } bool Date::operator(const Date d) const {return (*this d) || (*this d); } bool Date::operator(const Date d) const {return !(*this d); } bool Date::operator(const Date d) const {return !(*this d); }int Date::operator-(const Date d) const {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; }//int Date::operator-(const Date d) //{ // Date max *this; // Date min d; // int flag 1; // int count 0; // if (*this d) // { // max d; // min *this; // flag -1; // } // int day1 max._day; // int day2 min._day; // int n max._year - min._year; // if (max._year min._year) // { // n 0; // } // // // 2025 1 31 // while (max._month ! 1 || max._day ! 1) // { // max._month--; // if (max._month 0) // { // max._month 12; // max._year--; // break; // } // max._day GetMonthDay(max._year, max._month); // day1 max._day; // } // //2024 1 1 // while (min._month ! 1 || min._day ! 1) // { // min._month--; // if (min._month 0) // { // min._month 12; // min._year--; // break; // } // min._day GetMonthDay(min._year, min._month); // day2 min._day; // } // int x min._year; // while (x max._year) // { // count Getleapyear(min._year 1); // x; // } // // return day1 - day2 365 * n count1; //}
http://www.zqtcl.cn/news/264723/

相关文章:

  • 外贸网站 源码做的好详情页网站
  • 冀州网站制作邢台百姓网官网
  • 佛山做外贸网站方案自助网站推广系统
  • 安徽鸿顺鑫城建设集团网站小区物业管理网站开发报告
  • 有关网站建设文章常熟做网站多少钱
  • 网站流量报表江苏住房和城乡建设厅网站
  • 提供做网站公司有哪些个人建网站的费用
  • 网站后台添加表格wordpress垂直分页导航插件
  • 重庆网站建设有限公司六安市裕安区建设局网站
  • 北京产品网站建设如何做移动支付网站
  • 做同城购物网站赚钱吗设计企业网站流程
  • 网站要用什么软件做建设工程施工合同专属管辖
  • 模板网站建设制作佛山正规网站建设哪家好
  • 飞虎队网站建设网络公司起名大全
  • 如何发布自己的网站视频8首页制作代码
  • 网站开发实用案例教程普陀网站制作
  • 建一个网站需要哪些知识招远网站建设
  • 文章标题-栏目名称-网站名 dede环保网站设计建设论文
  • centos wordpress建站北京专门做网站的
  • wordpress网站的彻底清理百度网站联系方式
  • 网站建设签收单网页制作模板的作用
  • 已购买域名 如何做网站网络规划设计师通过率多少
  • 酒店网站建设需求分析wordpress iis
  • 烟台网站建设服务新钥匙网站建设
  • 帝国cms网站地图生成器行业网站建设哪家专业
  • 免费推广网站大全wordpress更改图片大小
  • 中航建设集团网站vps网站无法通过ip访问
  • 学生求职网站的需求分析怎么做江西手机版建站系统开发
  • 电商网站开发文献综述嵌入式软件开发项目
  • 网站备案怎样提交管局网站建设基本步骤