⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bigcar.cpp

📁 是一款车库模拟控制系统,可以实现对当前车库存车状态的实时描述.
💻 CPP
字号:
// BigCar.cpp: implementation of the CBigCar class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "garage.h"
#include "BigCar.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
//#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CBigCar *CBigCar::p_free=NULL;

int CBigCar::getCharge(){
	COleDateTimeSpan timespan(0,0,1,0);
	timespan=COleDateTime::GetCurrentTime()-inTime;
	int fee=(timespan.GetDays()*24*2+timespan.GetHours()*2)*unitPrice;
	if(timespan.GetMinutes()>0||timespan.GetSeconds()>0)
		fee+=(timespan.GetMinutes()/30+1)*unitPrice;
	return fee;
}

void *CBigCar::operator new(size_t size)
{
	CBigCar * p;
	if(p_free==NULL)
	{
		p_free=(CBigCar*)new char[size*NUM2];
		for(p=p_free;p!=p_free+NUM2-1;p++)
			p->next=p+1;
		p->next=NULL;
	}
	p=p_free;
	p_free=p_free->next;
	memset(p,0,size);
	return p;
}
void CBigCar::operator delete(void *p)
{
	((CBigCar*)p)->next=p_free;
	p_free=(CBigCar*)p;
}

⌨️ 快捷键说明

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