#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)计算程序耗时间
最新推荐文章于 2023-11-24 21:00:42 发布