#include "time.h" using namespace std; int main(){ clock_t start, finish; double time_length; start = clock();//start //计算时间的代码片 finish = clock();//finish time_length = (double)(finish - start) / CLOCKS_PER_SEC;//根据两个时刻的差,计算出运行的时间 cout<<"Time used is "<<time_length<<" second."<<endl; return 0; }