代码运行时间
c++
1)GetTickCount()
#inlcude <windows.h>
int main() { DWORD start_time = GetTickCount(); { //code } DWORD end_time = GetTickCount(); cout << "running times:" << end_time-start_time << "ms" << endl; return 0; }
2)clocl()
#include <time.h> int main() { clock_t start_time = clock(); { //code } clock_t end_time = clock(); cout << "running time:" << static_cast<double>(end_time-start_time)/CLOCK_PER_SEC*1000 << "ms" << endl; return 0; }