zoukankan      html  css  js  c++  java
  • get the runing time of C++ console program.

    // 获取程序运行时间.cpp : 定义控制台应用程序的入口点。
    //

    #include "stdafx.h"
    #include <time.h>
    #include <iostream>
    using namespace std;
    int _tmain(int argc, _TCHAR* argv[])
    {
        clock_t Start=0,Finish=0;
        double Totaltime=0;
        for(int i=0;i<10;i++)
        {
            //cout<<i;
            if(i==5)
                cout<<endl;
        }
        finish=clock();
        totaltime=(double)(Finish-start)/CLOCKS_PER_SEC;
        cout<<" finish="<<Finish<<endl;
        cout<<" start="<<Start<<endl;
        cout<<" 此程序的运行到此的时间为:"<<totaltime<<"秒!,="<<totaltime/60<<"分!="<<totaltime/3600<<"小时!"<<endl;
        return 0;
    }

  • 相关阅读:
    混合背包
    二维背包
    0/1背包问题(DP)
    冒泡排序
    快速排序
    最长上升子序列
    二分查找
    n后问题
    crontab 定时任务
    删除以某字符串开头的表
  • 原文地址:https://www.cnblogs.com/AmatVictorialCuram/p/3607249.html
Copyright © 2011-2022 走看看