C 练习实例93

C 语言教程 · 2019-02-22 17:13:01

题目:时间函数举例2

程序分析:无。

程序源代码:

//  Created by www.codercto.com on 15/11/9.
//  Copyright © 2015年 码农教程. 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秒。\n",TheTimes);
    return 0;
}

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

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

点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html

查看所有标签

Web应用测试

Web应用测试

纽恩 (Hung Q.Nguyen) / 冯学民 / 第1版 (2003年4月1日) / 2003-4 / 29.0

一起来看看 《Web应用测试》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码