編寫函式,要求輸入年月日時分秒,輸出該時間的下一秒

2021-06-10 06:35:13 字數 548 閱讀 7654

#include

#include

using namespace std;

void resetthetime(int *year,int *month,int *date,int *hour,int *minute,int *second)

;if (*year <0 || *month <1 || *month >12 || *date <1 ||*date >31

||*hour <0 ||*hour >23 || *minute <0 ||*minute>59 || *second <0 || *second >59)

if (*year <0 || *month < 1 || *month >12)

*second +=1;

if (*second >=60)}}

}}cout <<*year << ' '<<*month << " " << *date << ' ' << *hour << ' ' << *minute << ' ' << *second;

return ;

}int main()

輸入年月日時分秒,輸出該年月日時分秒的下一秒

編寫乙個函式,要求輸入年月日時分秒,輸出該年月日時分秒的下一秒。如輸入2004年12月31日23時59分59秒,則輸出2005年1月1日0時0分0秒 考慮如何幾種情形 演算法思路 1 判斷現在月份是大月還是小月 大月 1月,3月,5月,7月,8月,10月,12月 31天 小月 2月 28天或者29天...

獲取年月日時分秒

calendar ca calendar.getinstance int year ca.get calendar.year 獲取年份 2016 system.out.println year int month ca.get calendar.month 獲取月份 10 1 system.out....

python年月日時分秒

通過datetime函式獲取 import datetime 取當前時間 print datetime.datetime.now 取年 print datetime.datetime.now year 取月 print datetime.datetime.now month 取日 print dat...