如何计算程序话费的时间?

 

下面列出简单的例子

#include <ctime> //计时用的头文件

#include <iostream>

using namespace std;

int main()

{

    time_t start,end,time; /*注意计时所用的变量名称*/

    /*程序开始执行,开始计时*/

    start=clock();

    /*程序执行过程……*/

   自己的程序代码

    /*程序结束执行,结束计时*/

    end=clock();

    time=end-start;//这里的时间是计算机内部时间

    cout << endl << ""time:" << time << endl;

    system("pause");

    return 0;

}

相关文章:

  • 2021-07-18
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2021-09-28
  • 2021-09-24
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-28
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2021-12-29
  • 2021-06-21
相关资源
相似解决方案