TA貢獻1779條經驗 獲得超6個贊
C+與C共享它的日期/時間函數。TM結構對于C+程序員來說,可能是最容易處理的-今天的日期如下:
#include <ctime>#include <iostream>int main() { std::time_t t = std::time(0); // get time now std::tm* now = std::localtime(&t); std::cout << (now->tm_year + 1900) << '-' << (now->tm_mon + 1) << '-' << now->tm_mday << "\n";}
舉報
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號