watch.cpp

来自「此文件可以能帮你求体积」· C++ 代码 · 共 49 行

CPP
49
字号
// Watch.cpp: implementation of the Watch class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Watch.h"
#include <iostream.h>

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Watch::Watch()
{
	begin = end = 0.0;
}

Watch::Watch( clock_t t )
{
	cout << "begin...\n";
	cout.flush();
	begin = (double)t/CLK_TCK;
	end = 0.0;
}

void Watch::Start()
{
	cout << "begin...\n";
	cout.flush();
	begin = (double)clock()/CLK_TCK;
}

void Watch::Stop()
{
	end = (double)clock()/CLK_TCK;
	Show();
}

void Watch::Show()
{
	cout << "stop. \nElapsed time:" << (end - begin) << "秒\n\n";
	cout.flush();
}

Watch::~Watch()
{
	
}

⌨️ 快捷键说明

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