// C7_5.cpp : Defines the entry point for the console application. // 取得日期或時間字串 -- ctime() , asctime() , _strdate() , _strtime() #include "stdafx.h" #include #include int main(int argc, char* argv[]) { time_t T; time(&T); struct tm *TimeNow; // 利用結構 tm TimeNow=localtime(&T); //ctime() cout << "利用 ctime() 函數" << endl; cout << " 區域時間 : " << ctime(&T) << endl; //asctime() -- 轉換時間結構為字元字串 cout<< "利用 asctime() 函數" << endl; cout << "顯示的時間字串 : " << asctime(TimeNow) << endl; char Get_date[9]; char Get_time[9]; //_strdate() _strdate(Get_date); cout<<"利用 _strdate() 函數"<