码迷,mamicode.com
首页 > 其他好文 > 详细

记录时间的方法

时间:2018-05-13 13:47:44      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:记录   tar   pac   net   href   clock   http   namespace   main   

https://blog.csdn.net/xiong452980729/article/details/51394036

    #include<iostream>
    #include<time.h>  

    using namespace std;  

    int main()  
    {  
        clock_t startTime,endTime;  
        startTime = clock();  
        for (int i = 0; i < 1000000; i++)  
        {  
            i++;  
        }  
        endTime = clock();  
        cout << "Totle Time : " <<(double)(endTime - startTime) / CLOCKS_PER_SEC << "s" << endl;  
        system("pause");  
        return 0;  
    }
#include<iostream>  
#include<time.h>  

using namespace std;  

int main()  
{  
    for (int i = 0; i < 1000000; i++)  
    {  
        i++;  
    }  
    cout << "Totle Time : " << (double)clock() /CLOCKS_PER_SEC<< "s" << endl;  
    system("pause");  
    return 0;  
}

 

记录时间的方法

标签:记录   tar   pac   net   href   clock   http   namespace   main   

原文地址:https://www.cnblogs.com/Miracevin/p/9031656.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!