1.
#include <time.h> time_t begin_t = clock(); // to do time_t finish_t = clock(); cout<<"it cost " << (double )(finish_t - begin_t )/CLOCKS_PER_SEC <<" s"<<endl;
2.
#include <boost/timer.hpp>
boost::timer timer; // to do cout<<" cost time: "<<timer.elapsed() <<endl;
p,li { white-space: pre-wrap }
时间: 2024-10-09 08:53:53