第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

日期相差天數(shù)有關(guān)公元前

日期相差天數(shù)有關(guān)公元前

C++
晴書 2017-04-17 23:16:22
下面附上我的代碼 公元之后的我寫了 公元前還沒有#include <iostream>using namespace std;class Date{?friend int Delta(Date d1, Date d2)?{??int days = 0;??if (d1.year > 0&&d2.year > 0)??{???for (int i = d1.year; i < d2.year; i++)???{????if ((i % 4 == 0 && i % 100 == 0) || i % 400 == 0)?????days += 366;????else?????days += 365;???}??}??else??{???for (int i = d1.year; i < d2.year; i++)???{????if (((i+1) % 4 == 0 && (i+1) % 100 == 0) || (i+1) % 400 == 0)?????days += 366;????else?????days += 365;???}??}??if (d1.month > 0)??{???for (int j = 1; j < d1.month; j++)???{????if (j == 1 || j == 3 || j == 5 || j == 7 || j == 8 || j == 10 || j == 12)?????days -= 31;????else if (j == 4 || j == 6 || j == 9 || j == 11)?????days -= 30;????else if (j == 2)????{?????if ((d1.year % 4 == 0 && d1.year % 10 == 0) || d1.year % 400 == 0)??????days -= 29;?????else??????days -= 28;????}???}??}??else??{??}??days -= d1.day;??if (d2.month > 0)??{???for (int k = 1; k < d2.month; k++)???{????if (k == 1 || k == 3 || k == 5 || k == 7 || k == 8 || k == 10 || k == 12)?????days += 31;????else if (k == 4 || k == 6 || k == 9 || k == 11)?????days += 30;????else if (k == 2)????{?????if ((d2.year % 4 == 0 && d2.year % 10 == 0) || d2.year % 400 == 0)??????days += 29;?????else??????days += 28;????}???}??}??else??{??}??days += d2.day;??return days;?}?friend std::istream & operator>>(std::istream & is, const Date &d)?{??is >> d.year;??cout << "-";??is >> d.month;??cout << "-";??is >> d.day;??cout << endl;??return is;?}public:?Date()?{??year = 0;??month = 0;??day = 0;?}?~Date(){}?Date(int y, int m, int d)?{??year = y;??month = m;??day = d;?}private:?int year;?int month;?int day;};int main(){?Date date1, date2;?cin >> date1 >> date2;?int delt = Delta(date2, date1);?cout << delt << endl;?return 0;}求大神幫幫忙
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關(guān)注
  • 1060 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號