C++程序运行时间计算(二)
#include "hptime.h"
#include <iostream>
#include <Windows.h>
#include <time.h>
#include <cmath>
using namespace std;
void CalcTime()
{
unsigned long diff = 10000000;
while(diff > 0)
{
--diff;
}
Sleep(1000);
}
int main()
{
clock_t start, end;
start = clock();
CalcTime();
end = clock();
int tm =difftime(end, start);
cout << tm << endl;
int wait;
cin >> wait;
return 0;
}