include<iostream>
#include<ctime>
using namespace std;
int main()
{
clock_t startTime,endTime;
for (int i = 0; i < 2147483640; i++)
{
i++;
}
startTime = clock();//计时开始
for ( i = 0; i < 2147483640; i++)
{
i++;
}
endTime = clock();//计时结束
cout << "The run time is:" <<(double)(endTime - startTime) / CLOCKS_PER_SEC << "s" << endl;
cout << "The run time is:" << (double)clock() /CLOCKS_PER_SEC<< "s" << endl;
system("pause");
return 0;
}
C/C++中代码段运行时间/程序运行时间
猜你喜欢
转载自blog.csdn.net/weixin_45019478/article/details/104857557
今日推荐
周排行