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(¤tTime);
struct tm *p = localtime(¤tTime); 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; }