亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

c語言clock函數(shù)使用示例

 更新時(shí)間:2014年04月01日 16:14:01   作者:  
這篇文章主要介紹了c語言clock函數(shù)使用示例,需要的朋友可以參考下

clock_t clock( void );
Calculates the processor time used by the calling process
head file is <time.h>

Return Value
clock returns the number of clock ticks of elapsed processor time. The returned value
is the product of the amount of time that has elapsed since the start of a process and
the value of the CLOCKS_PER_SEC constant. If the amount of elapsed time is
unavailable, the function returns –1, cast as a clock_t.

Remarks
The clock function tells how much processor time the calling process has used. The
time in seconds is approximated by dividing the clock return value by the value of the
CLOCKS_PER_SEC constant. In other words, clock returns the number of
processor timer ticks that have elapsed. A timer tick is approximately equal to
1/CLOCKS_PER_SEC second. In versions of Microsoft C before 6.0, the
CLOCKS_PER_SEC constant was called CLK_TCK.

復(fù)制代碼 代碼如下:

/* CLOCK.C: This example prompts for how long
 * the program is to run and then continuously
 * displays the elapsed time for that period.
 */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void sleep( clock_t wait );
void main( void )
{
   long    i = 600000000L;
   clock_t start, finish;
   double  duration;
   /* Delay for a specified time. */
   printf( "Delay for three seconds\n" );
   sleep( (clock_t)3 * CLOCKS_PER_SEC );
   printf( "Done!\n" );
   /* Measure the duration of an event. */
   printf( "Time to do %ld empty loops is ", i );
   start = clock();
   while( i-- )

   finish = clock();
   duration = (double)(finish - start) / CLOCKS_PER_SEC;
   printf( "%2.1f seconds\n", duration );
}
/* Pauses for a specified number of milliseconds. */
void sleep( clock_t wait )
{
   clock_t goal;
   goal = wait + clock();
   while( goal > clock() )

}//sleep

相關(guān)文章

  • 二分圖匹配實(shí)例代碼及整理

    二分圖匹配實(shí)例代碼及整理

    這篇文章主要介紹了二分圖匹配實(shí)例代碼及整理的相關(guān)資料,這里提供了三種方法包括匈牙利算法,KM算法,多重匹配,需要的朋友可以參考下
    2017-07-07
  • QT編寫簡(jiǎn)單登錄界面的實(shí)現(xiàn)示例

    QT編寫簡(jiǎn)單登錄界面的實(shí)現(xiàn)示例

    登陸界面是網(wǎng)頁中常見的界面,本文主要介紹了QT編寫簡(jiǎn)單登錄界面的實(shí)現(xiàn)示例,具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-02-02
  • C++中CString string char* char 之間的字符轉(zhuǎn)換(多種方法)

    C++中CString string char* char 之間的字符轉(zhuǎn)換(多種方法)

    在寫程序的時(shí)候,我們經(jīng)常遇到各種各樣的類型轉(zhuǎn)換,比如 char* CString string 之間的互相轉(zhuǎn)換,這里簡(jiǎn)單為大家介紹一下,需要的朋友可以參考下
    2017-09-09
  • c語言尾隊(duì)列tailq使用示例分享

    c語言尾隊(duì)列tailq使用示例分享

    這篇文章主要介紹了c語言尾隊(duì)列tailq使用示例,大家參考使用吧
    2014-01-01
  • 樹形結(jié)構(gòu)的3中搜索方式示例分享

    樹形結(jié)構(gòu)的3中搜索方式示例分享

    樹的3中常見搜索方式,包括二叉樹方式(每一層只有0和1)、滿m叉樹(每一層都有0 到m - 1)、子集樹,也稱為全排列樹,需要的朋友可以參考下
    2014-02-02
  • C++關(guān)于引用作為函數(shù)的用法

    C++關(guān)于引用作為函數(shù)的用法

    今天小編就為大家分享一篇關(guān)于C++關(guān)于引用作為函數(shù)的用法,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧
    2018-12-12
  • C語言printf詳細(xì)解析

    C語言printf詳細(xì)解析

    C中格式字符串printf()的一般形式為: %[標(biāo)志][輸出最小寬度][.精度][長(zhǎng)度]類型, 其中方括號(hào)[]中的項(xiàng)為可選項(xiàng)。各項(xiàng)的意義介紹如下
    2013-09-09
  • C語言基礎(chǔ)指針詳解教程

    C語言基礎(chǔ)指針詳解教程

    此處對(duì)于指針做一些簡(jiǎn)要的介紹,作者實(shí)屬初學(xué),寫博客也是作者學(xué)習(xí)的一個(gè)過程,難免文章中有內(nèi)容理解不到位或者有不當(dāng)之處,還請(qǐng)朋友們不吝指正,希望大家給予支持
    2021-11-11
  • C語言獲得電腦的IP地址的小例子

    C語言獲得電腦的IP地址的小例子

    C語言獲得電腦的IP地址的小例子,需要的朋友可以參考一下
    2013-05-05
  • 哈夫曼的c語言實(shí)現(xiàn)代碼

    哈夫曼的c語言實(shí)現(xiàn)代碼

    著先通過 HuffmanTree() 函數(shù)構(gòu)造哈夫曼樹,然后在主函數(shù) main()中自底向上開始(也就是從數(shù)組序號(hào)為零的結(jié)點(diǎn)開始)向上層層判斷,若在父結(jié)點(diǎn)左側(cè),則置碼為 0,若在右側(cè),則置碼為 1。最后輸出生成的編碼
    2013-07-07

最新評(píng)論