#include<stdio.h>
#include<time.h>
#include<iostream>

using namespace std;
clock_t start, stop;
double duration;
void ls(int n);

int main()
{
start = clock();
ls(10);
stop = clock();
duration = ((double)(stop - start)) / CLK_TCK;
cout <<" 用时:"<<duration << endl;


system("pause");
return 0;
}


void ls(int n)
{
for (int i = 0; i < n; i++)
{
cout << i << endl;
}

}


注意:如何测出不到1个tick的程序运行时间?

答案是:重复

vs打印函数运行时间

相关文章:

  • 2022-12-23
  • 2021-08-28
  • 2021-12-15
  • 2022-12-23
  • 2021-11-07
  • 2022-12-23
猜你喜欢
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2022-01-07
  • 2022-12-23
  • 2022-01-30
相关资源
相似解决方案