C++程序运行时间

总是有些小技巧需要找个地方记录的。

#include <iostream>  
#include <ctime> 
#include <Windows.h>
using namespace std;

int main()   
{      
    clock_t start,finish;     
 
    start=clock();   
    Sleep(500);
    finish=clock();   

    double time = finish-start;   
    cout<<"过了"<<time<<"ms"<<endl;

    system("pause"); 
    return 0;
}  
原文地址:https://www.cnblogs.com/tiandsp/p/2957968.html