get the runing time of C++ console program.
2014-03-18 11:32
344 查看
// 获取程序运行时间.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
//
#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<<"\nfinish="<<Finish<<endl;
cout<<"\nstart="<<Start<<endl;
cout<<"\n此程序的运行到此的时间为:"<<totaltime<<"秒!,="<<totaltime/60<<"分!="<<totaltime/3600<<"小时!"<<endl;
return 0;
}
相关文章推荐
- Demo version of the real-time face detection program
- question 002: dev c++ 当中如何调整字体大小?How to get the first program with C++? c++属于什么软件?
- C/C++获取时间方法:gettimeofday()
- 在C++中怎样获得数组的大小?(原文标题:How Would You Get the Count of an Array in C++?)
- Get the Degree of Angle Between Hour and Minute Hand of a Clock at Anytime
- How to get the size of file in C++ - 在C++中如何获取文件的大小
- The Program of Algorithms ------- Sorting in Linear Time---- Bucket Sort
- C++ philosophy: Changing the accessibility of a class member should never change the meaning of a program.
- Get the Degree of Angle Between Hour and Minute Hand of a Clock at Anytime
- How Would You Get the Count of an Array in C++?
- C/C++程序计时函数gettimeofday的使用
- Linux时间函数C++之gettimeofday()函数之使用方法
- Question 17: Which of the following identify const-correctness failures in the C++ program below?
- Question 38: What is the output of the program below in C++?
- The Program of Algorithms ------- Sorting in Linear Time---- Counting Sort
- How Would You Get the Count of an Array in C++?
- Description of the default C and C++ libraries that a program will link with when built by using Vis
- C++程序在debug模式下遇到Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call问题。
- get the links of google searching result or baidu searching result
- the table of the escape sequences.(C++ primer plus)