stowatch.cpp

来自「Design Componenet With C++ STL配套书源代码」· C++ 代码 · 共 26 行

CPP
26
字号
// stowatch.cpp       #include"stowatch.h"#include<cassert>#include <iostream>void Stopwatch::start(){     ftime(&starttime);      state        = running;}void Stopwatch::stop(){     ftime(&stoptime);      state        = halted;}double Stopwatch::duration(){     if(state == undefined)      assert(!("Stopwatch not started!\n"));      if (state == running)          ftime(&stoptime);      return double(stoptime.time - starttime.time)           + double(stoptime.millitm           - starttime.millitm)/1000.0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?