时间函数
#include <windows.h>
LARGE_INTEGER tick
, begin
, end
;
QueryPerformanceFrequency(&tick
);
QueryPerformanceCounter(&begin
);
QueryPerformanceCounter(&end
);
cout
<< "计数器频率:" << tick
.QuadPart
<< "Hz" << endl
;
cout
<< "时钟计数 :" << end
.QuadPart
- begin
.QuadPart
<< endl
;
cout
<< setprecision(6) << (end
.QuadPart
- begin
.QuadPart
) / double(tick
.QuadPart
) << "秒" << endl
;
延时循环
#include<ctime>
不啦不啦
float secs
;
cin
>>secs
;
clock_t delay
=secs
*CLOCK_PER_SEC
;
clock_start
=clock();
while(clock()-start
<delay
)
;
————数学函数————
向下取整函数floor(x):
返回不超过x的最大整数。
转载请注明原文地址: https://lol.8miu.com/read-7151.html