C 練習實例92
題目:時間函數舉例2
程式分析:無。
程式源代碼:
// Created by www.xuhuhu.com on 15/11/9.
// Copyright © 2015年 IT研修. All rights reserved.
//
#include <stdio.h>
#include <time.h>
int main()
{
time_t start,end;
int i;
start=time(NULL);
for(i=0;i<300000;i++)
{
printf("\n"); // 返回兩個time_t型變數之間的時間間隔
}
end=time(NULL);
// 輸出執行時間
printf("時間間隔為 %6.3f\n",difftime(end,start));
}
以上實例運行輸出結果為:
時間間隔為 1.000

C 語言經典100例