c++ 打印時間


 

https://blog.csdn.net/u011288190/article/details/45722925

 

輸出麻煩, 改造一下:

#include<iostream>
#include<time.h>
#include<stdio.h>

using namespace std;

int main()
{
    time_t currentTime;
    time(&currentTime);
struct tm *p = localtime(&currentTime); char str[200] = {0}; snprintf(str, 200, "Hour:%d, minit: %d, second: %d", p->tm_hour, p->tm_min, p->tm_sec); cout << str<< endl; }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM