简介:只要会C++就能看懂的程序就不解释了
#include <time.h>
#include <iostream>
int fun()
{
for (int i = 0; i < 100; i++)
{
for (int j = 0; j < 100; j++)
{
std::cout << i + j;
}
}
return 0;
}
int main()
{
clock_t start_time = clock();//记录起始时间
fun();
clock_t end_time = clock();//记录结束时间
auto run_time = double(1000 * (end_time - start_time)) / CLOCKS_PER_SEC;//单位为毫秒
std::cout << "run time: " << run_time << "ms\n";
return 0;
}
网友评论