5、原理與內(nèi)容、實(shí)驗(yàn)步驟與記錄、實(shí)驗(yàn)分析與結(jié)論等。3.設(shè)計(jì)一個(gè)日期類(lèi)Date,包括日期的年份、月份和日號(hào),要求能夠設(shè)置日期、按照年/月/日的格式輸出日期、編寫(xiě)友元函數(shù),求兩個(gè)日期之間相差的天數(shù)。l程序源代碼(注意添加注釋?zhuān)?includeusingnamespacestd;intwhatday(inty,intm,intd);classDate{intyear,month,day;public:voidmodify_year(inty){year=y;}voidmodify_month(intm){month=
6、m;}voidmodify_day(intd){day=d;}Date(inty=1900,intm=1,intd=1):year(y),month(m),day(d){}voidout(){cout<<"日期為:"<=d2.year)returnabs((d1.year-d2.ye
7、ar)*365+whatday(d1.year,d1.month,d1.day)-whatday(d2.year,d2.month,d2.day));elsereturnabs((d2.year-d1.year)*365+whatday(d2.year,d2.month,d2.day)-whatday(d1.year,d1.month,d1.day));}intwhatday(inty,intm,intd)//此函數(shù)計(jì)算m月d日是本年的第幾天{intwhatd=d;switch(m){case12:whatd+=30;case
8、11:whatd+=31;case10:whatd+=30;case9:whatd+=31;case8:whatd+=31;case7:whatd+=30;case6:whatd+=31;case5:whatd+=30;case4:whatd+=31;case3:if(y%4