全文预览

C++编程入门宝典

上传者:塑料瓶子 |  格式:pdf  |  页数:57 |  大小:5759KB

文档介绍
aluation Warning : The document was created with Spire.PDF for .NET.\rcKà ÅÆ»¼P`p?3!=\rint operator != (Date& dt) { return !(*this==dt);}\rÉÅÆ0@P`p\r#include iostream.h\rclass Date\r(\rint mo,da,yr;\rstatic int dys[];\rpublic:\rDate(int m=0,int d=O,int y=0)\r{ mo=m; da=d; yr=y;}\rvoid displayO const\r{ cout< Date operator + (int) const;\rDate operator +=(int)\r{ *this=*this+n; return *this;}\r)l\rint Date::dys[]={31,28,31,30,31,30,31,31,30,31,30,31);\rDate Date: :operator+(int) const\r(\rDate dt=*this;\rn+=dt.da;\rwhile(n>=dys|dt.mo-1 J)\r(\rn-=dys[dt.mo-l];\rif(++dt.da==13)\r(\rdt.mo=l;\rdt,yr++;\r)\r)\rdt.da=n;\rreturn dt;\r)\rint main()\r(\rDate olddate(lj,2005);\rolddate+=100;\rolddate.displayO;\rreturn 0;.\r)

收藏

分享

举报
下载此文档