你值得拥有:
看代码:(1)
1 #include <ctime> 2 #include <iostream> 3 int main() 4 { 5 std::time_t result = std::time(NULL); 6 std::cout << std::ctime(&result); 7 }
看代码:(2)
1 #include <ctime> 2 #include <iostream> 3 4 int main() 5 { 6 std::time_t result = std::time(NULL); 7 std::cout << std::asctime(std::localtime(&result)); 8 }