用高精度计时器 #include <iostream> #include <windows.h> using namespace std ; int main(void) { LARGE_INTEGER BegainTime ; LARGE_INTEGER EndTime ; LARGE_INTEGER Frequency ; QueryPerformanceFrequency(&Frequency); QueryPerformanceCounter(&BegainTime) ; //要测试的代码放在这里 QueryPerformanceCounter(&EndTime) ; cout << ( EndTime.QuadPart - BegainTime.QuadPart )*1000 / Frequency.QuadPart ; system("pause") ; return 0 ; }