C++求代码运行时间:
#include<ctime> // 引入头文件ctime
clock_t start = clock();
function(); // 需要求时间的代码块
clock_t end = clock();
double programTimes = ((double)end - start) / CLOCKS_PER_SEC; // 运行时间
C++求代码运行时间:
#include<ctime> // 引入头文件ctime
clock_t start = clock();
function(); // 需要求时间的代码块
clock_t end = clock();
double programTimes = ((double)end - start) / CLOCKS_PER_SEC; // 运行时间