Latest web development tutorials

C 練習實例91

C 語言經典100例 C語言經典100例

題目:時間函數舉例1

程序分析:無。

程序源代碼:

//  Created by www.w3big.com on 15/11/9.
//  Copyright © 2015年 本教程. All rights reserved.
//

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

int main ()
{
    time_t rawtime;
    struct tm * timeinfo;
    
    time ( &rawtime );
    timeinfo = localtime ( &rawtime );
    printf ( "当前本地时间为: %s", asctime (timeinfo) );
    
    return 0;
}

以上實例運行輸出結果為:

当前本地时间为: Tue Nov 10 16:28:49 2015

C 語言經典100例 C語言經典100例