// C7_4.cpp : Defines the entry point for the console application. // 時間函數 -- 取得系統日期與時間 #include "stdafx.h" #include #include int main(int argc, char* argv[]) { ` time_t T; //time() time(&T); cout << "從 1970/01/01 00:00:00 日期開始的秒數 : " << endl; cout << T << " 秒" <tm_year) << "/"; cout << 1+(TimeNow->tm_mon) << "/"; cout << TimeNow->tm_mday << endl; cout << TimeNow->tm_min<<":"; cout << TimeNow->tm_sec << endl << endl; cout << "目前時刻 : " << TimeNow->tm_hour << ":" << TimeNow->tm_min << endl << endl ; return 0; }