首先定义clock_t start, end;
然后在自己要测试那段代码的前面加上start = clock(); 结尾加上end = clock();
最后用输出语句进行
cout<<"Run time: "<<(double)(end - start) / CLOCKS_PER_SEC<<"S"<<endl;
cout<<"Run time: "<<(double)(end - start)<<"ms"<<endl;
2023-12-24 14:35:58
首先定义clock_t start, end;
然后在自己要测试那段代码的前面加上start = clock(); 结尾加上end = clock();
最后用输出语句进行
cout<<"Run time: "<<(double)(end - start) / CLOCKS_PER_SEC<<"S"<<endl;
cout<<"Run time: "<<(double)(end - start)<<"ms"<<endl;