(5)计算程序耗时间

#include <cstdlib> #include <iostream> #include <time.h> using namespace std; int main(int argc, char *argv[]) {     long i=100000000L;     clock_t start,finish;     double waste;     cout<< "Time to do "<<i<< "empty loops is ";     start = clock();     while( i-- )       ;     finish = clock();     waste = (double)(finish - start) / CLOCKS_PER_SEC;     cout<<waste<<"seconds\n";     system("PAUSE");     return EXIT_SUCCESS; }

你可能感兴趣的:((5)计算程序耗时间)