#include<cstdio> #include<cstdlib> #include<ctime> using namespace std; int main() { int i=100000000; clock_t start,finish; double duration; start=clock();//开始计时刻 while(i--); finish=clock();//终止计时时刻 duration=(double)(finish-start)/(clock_t)(1000);//除以1000以秒为单位,否则单位是毫秒 printf("%llf ",duration); return 0; }