#include <iostream>
#include <windows.h>
#include <string>
using namespace std;
DWORD t1;
DWORD t2;
void timebegin()
{
t1 = GetTickCount();
}
void timeend(string str)
{
t2 = GetTickCount();
cout << str << " is "<< t2 - t1 << "ms" << endl;
}
void test()
{
float a = 1.2633;
float b = 1.5;
for (int i = 0; i < 10000; ++i)
{
a = a * 1.23696 / 1.02 * 0.95;
b = a * 1.6 / 1.5 * 0.63;
}
}
int main(int argc, char* argv[])
{
timebegin();
for (int i = 0; i < 100; ++i)
{
test();
}
timeend("time");
return 0;
}
windows下面的GetTickCount计时函数
猜你喜欢
转载自blog.csdn.net/adong76/article/details/41704191
今日推荐
周排行