C++计算时间.docVIP

  • 9
  • 0
  • 约5.14千字
  • 约 8页
  • 2018-03-20 发布于湖北
  • 举报
C++程序运行时间计算 1.如果只是要计算程序运行的时间,不需要那么复杂。 windows.h 中的 GetTickCount() 就是干这个的。?? TimeStart=GetTickCount(); ?? ....... ?? TimeEnd=GetTickCount(); ?? TimeUsed=TimeEnd-TimeStart; 2. #includestdio.h #includetime.h #includeconio.h int main() { time_t stime , etime ; time( stime ); /* get start time */ getch(); /* Access */ time( etime ); /* get end time */ printf( %ld\n , etime - stime ); getch(); return 0; } 3. class CTimer { public: CTimer() {QueryPerformanceFrequency(m_Frequency); Start();} void Start() {QueryPerformanceCounter(m_StartCount);} double End() {LARGE_INTEGER CurrentCo

文档评论(0)

1亿VIP精品文档

相关文档