C++计时

  

#include <ctime>
#include <iostream>

using namespace std;

int main(void)
{
    long i = 100000000L;
    clock_t start, finish;
    start = clock();
    
    while (i--)
    {
        /*
        do something
        */
    }
    finish = clock();

    cout << "time:" << (double)(finish - start) / CLOCKS_PER_SEC;

    system("pause");
}

 

posted on 2015-12-30 19:43  三杯不醉  阅读(156)  评论(0编辑  收藏  举报

导航