C 练习实例93

[

C 练习实例93
C 语言经典100例
题目:时间函数举例2

程序分析:无。
程序源代码:


//  Created by www.runoob.com on 15/11/9.

//  Copyright © 2015年 Break易站. All rights reserved.

//



#include <stdio.h>

#include <stdlib.h>

#include <time.h>



int main()

{

    long i=10000000L;

    clock_t start,finish;

    double TheTimes;

    printf("做%ld次空循环需要的时间为",i);

    start=clock();

    while(i--);

    finish=clock();

    TheTimes=(double)(finish-start)/CLOCKS_PER_SEC;

    printf("%f秒。
",TheTimes);

    return 0;

}

以上实例运行输出结果为:


做10000000次空循环需要的时间为0.025367秒。

C 语言经典100例

]
  •   本文标题:C 练习实例93 - Break易站
    转载请保留页面地址:https://www.breakyizhan.com/c-3/19858.html
    原文地址:https://www.cnblogs.com/breakyizhan/p/13272154.html