VS中计算程序运行的时间   http://bbs.csdn.net/topics/39068881

  有时候在设计程序完了之后需要计算程序运行的时间。

  这时候可以使用Windows的库函数 GetIickCount(),其头文件为<windows.h>  

#include<iostream>
#include<windows.h>
int main()
{
DWORD start_time=GetTickCount();
{
//此处为被测试代码
}
DWORD end_time=GetTickCount();
cout<<"The run time is:"<<(end_time-start_time)*1.00/1000<<"s!"<<endl;//输出运行时间
return 0;
}

 

 

相关文章:

  • 2021-12-15
  • 2021-12-15
  • 2021-12-15
  • 2021-05-23
  • 2021-09-05
  • 2021-07-08
  • 2021-07-19
猜你喜欢
  • 2021-09-05
  • 2021-06-14
  • 2021-10-19
  • 2022-12-23
相关资源
相似解决方案