C 練習(xí)實(shí)例92
題目:時(shí)間函數(shù)舉例2
程序分析:無。
程序源代碼:
// Created by www.o2fo.com on 15/11/9. // Copyright © 2015年 W3Cschool教程. 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"); // 返回兩個(gè)time_t型變量之間的時(shí)間間隔 } end=time(NULL); // 輸出執(zhí)行時(shí)間 printf("時(shí)間間隔為 %6.3f\n",difftime(end,start)); }
以上實(shí)例運(yùn)行輸出結(jié)果為:
時(shí)間間隔為 1.000
更多建議: